Skip to content

Commit 3c45ffb

Browse files
authored
Merge pull request #666 from auth0/feature/angular-10-support
Feature/angular 10 support
2 parents 566f4be + 403b68c commit 3c45ffb

14 files changed

+6579
-5924
lines changed
File renamed without changes.

e2e/tsconfig.e2e.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/app",
55
"module": "commonjs",

package-lock.json

Lines changed: 6462 additions & 5837 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,51 @@
88
"postbuild": "cp ./README.md ./CHANGELOG.md ./LICENSE ./dist/angular-jwt/",
99
"test": "ng test",
1010
"lint": "ng lint",
11-
"e2e": "ng e2e"
11+
"e2e": "ng e2e",
12+
"release": "np",
13+
"release:preview": "np --preview ",
14+
"release:dry": "np --no-publish"
1215
},
1316
"private": false,
1417
"dependencies": {
15-
"@angular/common": "~9.1.1",
16-
"@angular/compiler": "~9.1.1",
17-
"@angular/core": "~9.1.1",
18-
"url": "^0.11.0",
19-
"@angular/platform-browser": "~9.1.1",
20-
"@angular/platform-browser-dynamic": "~9.1.1",
18+
"@angular/common": "~10.0.1",
19+
"@angular/compiler": "~10.0.1",
20+
"@angular/core": "~10.0.1",
21+
"@angular/platform-browser": "~10.0.1",
22+
"@angular/platform-browser-dynamic": "~10.0.1",
2123
"core-js": "^3.2.1",
2224
"rxjs": "~6.5.3",
23-
"tslib": "^1.10.0",
25+
"tslib": "^2.0.0",
2426
"zone.js": "~0.10.3"
2527
},
2628
"devDependencies": {
27-
"@angular-devkit/build-angular": "~0.901.0",
28-
"@angular-devkit/build-ng-packagr": "~0.901.0",
29-
"@angular/cli": "~9.1.0",
30-
"@angular/compiler-cli": "~9.1.1",
31-
"@angular/language-service": "~9.1.1",
29+
"@angular-devkit/build-angular": "~0.1000.0",
30+
"@angular-devkit/build-ng-packagr": "~0.1000.0",
31+
"@angular/cli": "~10.0.0",
32+
"@angular/compiler-cli": "~10.0.1",
33+
"@angular/language-service": "~10.0.1",
3234
"@types/jasmine": "~3.4.1",
3335
"@types/jasminewd2": "~2.0.3",
3436
"@types/node": "^12.11.1",
3537
"codelyzer": "^5.1.2",
3638
"jasmine-core": "~3.5.0",
37-
"jasmine-spec-reporter": "~4.2.1",
38-
"karma": "~4.3.0",
39+
"jasmine-spec-reporter": "~5.0.0",
40+
"karma": "~5.0.0",
3941
"karma-chrome-launcher": "~3.1.0",
40-
"karma-coverage-istanbul-reporter": "~2.1.0",
41-
"karma-jasmine": "~2.0.1",
42-
"karma-jasmine-html-reporter": "^1.4.2",
43-
"ng-packagr": "^9.0.0",
44-
"protractor": "~5.4.0",
42+
"karma-coverage-istanbul-reporter": "~3.0.2",
43+
"karma-jasmine": "~3.3.0",
44+
"karma-jasmine-html-reporter": "^1.5.0",
45+
"ng-packagr": "^10.0.0",
46+
"np": "^6.2.5",
47+
"protractor": "~7.0.0",
4548
"ts-node": "~8.4.1",
46-
"tslib": "^1.9.0",
47-
"tslint": "~5.20.0",
48-
"typescript": "~3.7.5"
49+
"tslint": "~6.1.0",
50+
"typescript": "~3.9.5"
51+
},
52+
"np": {
53+
"contents": "dist/angular-jwt"
54+
},
55+
"publishConfig": {
56+
"access": "public"
4957
}
50-
}
58+
}

projects/angular-jwt/ng-package.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
{
2-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3-
"dest": "../../dist/angular-jwt",
4-
"lib": {
5-
"entryFile": "src/index.ts",
6-
"umdModuleIds": {
7-
"url": "url"
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/angular-jwt",
4+
"lib": {
5+
"entryFile": "src/index.ts"
86
}
9-
},
10-
"whitelistedNonPeerDependencies": [
11-
"url"
12-
]
13-
}
7+
}

projects/angular-jwt/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"peerDependencies": {
2323
"@angular/common": ">=7.1.0"
2424
},
25-
"dependencies": {
26-
"url": "^0.11.0"
27-
}
25+
"dependencies": {
26+
"tslib": "^2.0.0"
27+
}
2828
}

projects/angular-jwt/src/lib/jwt.interceptor.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { JwtHelperService } from "./jwthelper.service";
99
import { JWT_OPTIONS } from "./jwtoptions.token";
1010

1111
import { mergeMap } from "rxjs/operators";
12-
import { parse } from "url";
1312
import { from, Observable } from "rxjs";
1413

1514
@Injectable()
@@ -42,18 +41,22 @@ export class JwtInterceptor implements HttpInterceptor {
4241
}
4342

4443
isWhitelistedDomain(request: HttpRequest<any>): boolean {
45-
const requestUrl: any = parse(request.url, false, true);
46-
const hostName =
47-
requestUrl.hostname !== null
48-
? `${requestUrl.hostname}${
49-
requestUrl.port && !this.standardPorts.includes(requestUrl.port)
50-
? ":" + requestUrl.port
51-
: ""
52-
}`
53-
: requestUrl.hostname;
44+
const requestUrl: URL = new URL(request.url, window.location.origin);
45+
46+
// If the host equals the current window origin,
47+
// the domain is whitelisted by default
48+
if (requestUrl.host === window.location.host) {
49+
return true;
50+
}
51+
52+
// If not the current domain, check the whitelist
53+
const hostName = `${requestUrl.hostname}${
54+
requestUrl.port && !this.standardPorts.includes(requestUrl.port)
55+
? ":" + requestUrl.port
56+
: ""
57+
}`;
5458

5559
return (
56-
hostName === null ||
5760
this.whitelistedDomains.findIndex((domain) =>
5861
typeof domain === "string"
5962
? domain === hostName
@@ -65,15 +68,15 @@ export class JwtInterceptor implements HttpInterceptor {
6568
}
6669

6770
isBlacklistedRoute(request: HttpRequest<any>): boolean {
68-
const requestedUrl = parse(request.url, false, true);
71+
const requestedUrl: URL = new URL(request.url, window.location.origin);
6972

7073
return (
7174
this.blacklistedRoutes.findIndex((route: string | RegExp) => {
7275
if (typeof route === "string") {
73-
const parsedRoute = parse(route, false, true);
76+
const parsedRoute: URL = new URL(route, window.location.origin);
7477
return (
7578
parsedRoute.hostname === requestedUrl.hostname &&
76-
parsedRoute.path === requestedUrl.path
79+
parsedRoute.pathname === requestedUrl.pathname
7780
);
7881
}
7982

projects/angular-jwt/tsconfig.lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../../out-tsc/lib",
55
"target": "es2015",

projects/angular-jwt/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../../out-tsc/spec",
55
"types": [

src/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/app",
55
"types": []

src/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/spec",
55
"types": [

tsconfig.base.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"baseUrl": "./",
5+
"downlevelIteration": true,
6+
"outDir": "./dist/out-tsc",
7+
"sourceMap": true,
8+
"declaration": false,
9+
"module": "esnext",
10+
"moduleResolution": "node",
11+
"emitDecoratorMetadata": true,
12+
"experimentalDecorators": true,
13+
"importHelpers": true,
14+
"target": "es2015",
15+
"typeRoots": [
16+
"node_modules/@types"
17+
],
18+
"lib": [
19+
"es2018",
20+
"dom"
21+
],
22+
"paths": {
23+
"angular-jwt": [
24+
"projects/angular-jwt/src/index"
25+
],
26+
"angular-jwt/*": [
27+
"projects/angular-jwt/src/*"
28+
]
29+
}
30+
}
31+
}

tsconfig.json

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
1+
/*
2+
This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
3+
It is not intended to be used to perform a compilation.
4+
5+
To learn more about this file see: https://angular.io/config/solution-tsconfig.
6+
*/
17
{
2-
"compileOnSave": false,
3-
"compilerOptions": {
4-
"baseUrl": "./",
5-
"downlevelIteration": true,
6-
"outDir": "./dist/out-tsc",
7-
"sourceMap": true,
8-
"declaration": false,
9-
"module": "esnext",
10-
"moduleResolution": "node",
11-
"emitDecoratorMetadata": true,
12-
"experimentalDecorators": true,
13-
"importHelpers": true,
14-
"target": "es2015",
15-
"typeRoots": [
16-
"node_modules/@types"
17-
],
18-
"lib": [
19-
"es2018",
20-
"dom"
21-
],
22-
"paths": {
23-
"angular-jwt": [
24-
"projects/angular-jwt/src/index"
25-
],
26-
"angular-jwt/*": [
27-
"projects/angular-jwt/src/*"
28-
]
8+
"files": [],
9+
"references": [
10+
{
11+
"path": "./src/tsconfig.app.json"
12+
},
13+
{
14+
"path": "./src/tsconfig.spec.json"
15+
},
16+
{
17+
"path": "./e2e/tsconfig.e2e.json"
18+
},
19+
{
20+
"path": "./projects/angular-jwt/tsconfig.lib.json"
21+
},
22+
{
23+
"path": "./projects/angular-jwt/tsconfig.spec.json"
2924
}
30-
}
31-
}
25+
]
26+
}

tslint.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"no-trailing-whitespace": true,
7474
"no-unnecessary-initializer": true,
7575
"no-unused-expression": true,
76-
"no-use-before-declare": true,
7776
"no-var-keyword": true,
7877
"object-literal-sort-keys": false,
7978
"one-line": [

0 commit comments

Comments
 (0)