@inrupt/solid-client-authn-browser 1.11.7 → 1.11.8-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ClientAuthentication.d.ts +18 -17
- package/dist/Session.d.ts +35 -36
- package/dist/Session.js +2 -45
- package/dist/Session.js.map +1 -1
- package/dist/constant.d.ts +2 -2
- package/dist/defaultSession.d.ts +9 -9
- package/dist/dependencies.d.ts +6 -6
- package/dist/iframe.d.ts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.es.js +1693 -0
- package/dist/index.js +1717 -27
- package/dist/login/AggregateLoginHandler.d.ts +4 -4
- package/dist/login/oidc/AggregateOidcHandler.d.ts +4 -4
- package/dist/login/oidc/ClientRegistrar.d.ts +6 -6
- package/dist/login/oidc/IssuerConfigFetcher.d.ts +8 -8
- package/dist/login/oidc/OidcLoginHandler.d.ts +10 -10
- package/dist/login/oidc/Redirector.d.ts +4 -4
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.d.ts +8 -8
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.d.ts +9 -9
- package/dist/login/oidc/redirectHandler/AggregateRedirectHandler.d.ts +4 -4
- package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.d.ts +15 -16
- package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js +1 -23
- package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js.map +1 -1
- package/dist/login/oidc/redirectHandler/ErrorOidcHandler.d.ts +9 -9
- package/dist/login/oidc/redirectHandler/FallbackRedirectHandler.d.ts +7 -7
- package/dist/login/oidc/refresh/TokenRefresher.d.ts +10 -10
- package/dist/login/webid/WebIdLoginHandler.d.ts +5 -5
- package/dist/logout/GeneralLogoutHandler.d.ts +7 -7
- package/dist/sessionInfo/SessionInfoManager.d.ts +16 -16
- package/dist/sessionInfo/SessionInfoManager.js +0 -8
- package/dist/sessionInfo/SessionInfoManager.js.map +1 -1
- package/dist/solid-client-authn.bundle.js +1720 -2
- package/dist/storage/BrowserStorage.d.ts +7 -7
- package/dist/storage/StorageUtility.d.ts +4 -4
- package/dist/util/UuidGenerator.d.ts +6 -6
- package/dist/util/urlPath.d.ts +1 -1
- package/examples/demoClientApp/package-lock.json +85 -18
- package/examples/demoClientApp/package.json +2 -1
- package/examples/demoClientApp/src/DemoClientApp.js +9 -1
- package/examples/single/bundle/package-lock.json +18 -18
- package/jest.config.js +6 -1
- package/package.json +17 -29
- package/rollup.config.js +57 -0
- package/src/ClientAuthentication.spec.ts +69 -1
- package/src/ClientAuthentication.ts +32 -14
- package/src/Session.spec.ts +0 -224
- package/src/Session.ts +8 -88
- package/src/login/oidc/__mocks__/Redirector.ts +9 -9
- package/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.spec.ts +34 -18
- package/src/login/oidc/redirectHandler/AuthCodeRedirectHandler.spec.ts +3 -171
- package/src/login/oidc/redirectHandler/AuthCodeRedirectHandler.ts +0 -68
- package/src/login/oidc/redirectHandler/__mocks__/RedirectHandler.ts +13 -0
- package/src/sessionInfo/SessionInfoManager.spec.ts +0 -27
- package/src/sessionInfo/SessionInfoManager.ts +0 -10
- package/src/index.browser.spec.ts +0 -27
- package/src/index.browser.ts +0 -24
- package/webpack.browser.js +0 -19
- package/webpack.common.js +0 -22
- package/webpack.config.js +0 -8
- package/webpack.dev.js +0 -17
- package/webpack.prod.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IStorage } from "@inrupt/solid-client-authn-core";
|
|
2
|
-
export default class BrowserStorage implements IStorage {
|
|
3
|
-
get storage(): typeof window.localStorage;
|
|
4
|
-
get(key: string): Promise<string | undefined>;
|
|
5
|
-
set(key: string, value: string): Promise<void>;
|
|
6
|
-
delete(key: string): Promise<void>;
|
|
7
|
-
}
|
|
1
|
+
import { IStorage } from "@inrupt/solid-client-authn-core";
|
|
2
|
+
export default class BrowserStorage implements IStorage {
|
|
3
|
+
get storage(): typeof window.localStorage;
|
|
4
|
+
get(key: string): Promise<string | undefined>;
|
|
5
|
+
set(key: string, value: string): Promise<void>;
|
|
6
|
+
delete(key: string): Promise<void>;
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IStorage, StorageUtility } from "@inrupt/solid-client-authn-core";
|
|
2
|
-
export default class StorageUtilityBrowser extends StorageUtility {
|
|
3
|
-
constructor(secureStorage: IStorage, insecureStorage: IStorage);
|
|
4
|
-
}
|
|
1
|
+
import { IStorage, StorageUtility } from "@inrupt/solid-client-authn-core";
|
|
2
|
+
export default class StorageUtilityBrowser extends StorageUtility {
|
|
3
|
+
constructor(secureStorage: IStorage, insecureStorage: IStorage);
|
|
4
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface IUuidGenerator {
|
|
2
|
-
v4(): string;
|
|
3
|
-
}
|
|
4
|
-
export default class UuidGenerator {
|
|
5
|
-
v4(): string;
|
|
6
|
-
}
|
|
1
|
+
export interface IUuidGenerator {
|
|
2
|
+
v4(): string;
|
|
3
|
+
}
|
|
4
|
+
export default class UuidGenerator {
|
|
5
|
+
v4(): string;
|
|
6
|
+
}
|
package/dist/util/urlPath.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function appendToUrlPathname(url: string, append: string): string;
|
|
1
|
+
export declare function appendToUrlPathname(url: string, append: string): string;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@inrupt/solid-client-authn-browser": "file:../..",
|
|
12
13
|
"react": "^17.0.2",
|
|
13
14
|
"react-dom": "^17.0.2",
|
|
14
15
|
"regenerator-runtime": "^0.13.9"
|
|
@@ -26,6 +27,39 @@
|
|
|
26
27
|
"webpack-dev-server": "^4.7.3"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
30
|
+
"../..": {
|
|
31
|
+
"name": "@inrupt/solid-client-authn-browser",
|
|
32
|
+
"version": "1.11.7",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@inrupt/oidc-client-ext": "^1.11.7",
|
|
36
|
+
"@inrupt/solid-client-authn-core": "^1.11.7",
|
|
37
|
+
"@types/lodash.clonedeep": "^4.5.6",
|
|
38
|
+
"@types/node": "^17.0.2",
|
|
39
|
+
"@types/uuid": "^8.3.0",
|
|
40
|
+
"events": "^3.3.0",
|
|
41
|
+
"jose": "^4.3.7",
|
|
42
|
+
"lodash.clonedeep": "^4.5.0",
|
|
43
|
+
"uuid": "^8.3.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
47
|
+
"@types/jest": "^27.0.3",
|
|
48
|
+
"cross-fetch": "^3.0.6",
|
|
49
|
+
"eslint": "^7.16.0",
|
|
50
|
+
"jest": "^27.5.1",
|
|
51
|
+
"license-checker": "^25.0.1",
|
|
52
|
+
"rollup": "^2.38.4",
|
|
53
|
+
"rollup-plugin-polyfill-node": "^0.9.0",
|
|
54
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
55
|
+
"ts-jest": "^27.0.7",
|
|
56
|
+
"ts-loader": "^9.1.1",
|
|
57
|
+
"tsc-watch": "^5.0.2",
|
|
58
|
+
"typedoc": "^0.22.4",
|
|
59
|
+
"typedoc-plugin-markdown": "^3.10.2",
|
|
60
|
+
"typescript": "^4.0.5"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
29
63
|
"node_modules/@babel/code-frame": {
|
|
30
64
|
"version": "7.16.7",
|
|
31
65
|
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",
|
|
@@ -1691,6 +1725,10 @@
|
|
|
1691
1725
|
"node": ">=10.0.0"
|
|
1692
1726
|
}
|
|
1693
1727
|
},
|
|
1728
|
+
"node_modules/@inrupt/solid-client-authn-browser": {
|
|
1729
|
+
"resolved": "../..",
|
|
1730
|
+
"link": true
|
|
1731
|
+
},
|
|
1694
1732
|
"node_modules/@nodelib/fs.scandir": {
|
|
1695
1733
|
"version": "2.1.5",
|
|
1696
1734
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
|
@@ -2274,9 +2312,9 @@
|
|
|
2274
2312
|
}
|
|
2275
2313
|
},
|
|
2276
2314
|
"node_modules/async": {
|
|
2277
|
-
"version": "2.6.
|
|
2278
|
-
"resolved": "https://registry.npmjs.org/async/-/async-2.6.
|
|
2279
|
-
"integrity": "sha512-
|
|
2315
|
+
"version": "2.6.4",
|
|
2316
|
+
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
|
2317
|
+
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
|
2280
2318
|
"dev": true,
|
|
2281
2319
|
"dependencies": {
|
|
2282
2320
|
"lodash": "^4.17.14"
|
|
@@ -4524,9 +4562,9 @@
|
|
|
4524
4562
|
}
|
|
4525
4563
|
},
|
|
4526
4564
|
"node_modules/minimist": {
|
|
4527
|
-
"version": "1.2.
|
|
4528
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
4529
|
-
"integrity": "sha512-
|
|
4565
|
+
"version": "1.2.6",
|
|
4566
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
4567
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
4530
4568
|
"dev": true
|
|
4531
4569
|
},
|
|
4532
4570
|
"node_modules/mkdirp": {
|
|
@@ -4598,9 +4636,9 @@
|
|
|
4598
4636
|
"dev": true
|
|
4599
4637
|
},
|
|
4600
4638
|
"node_modules/node-forge": {
|
|
4601
|
-
"version": "1.
|
|
4602
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.
|
|
4603
|
-
"integrity": "sha512-
|
|
4639
|
+
"version": "1.3.0",
|
|
4640
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz",
|
|
4641
|
+
"integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==",
|
|
4604
4642
|
"dev": true,
|
|
4605
4643
|
"engines": {
|
|
4606
4644
|
"node": ">= 6.13.0"
|
|
@@ -7797,6 +7835,35 @@
|
|
|
7797
7835
|
"integrity": "sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA==",
|
|
7798
7836
|
"dev": true
|
|
7799
7837
|
},
|
|
7838
|
+
"@inrupt/solid-client-authn-browser": {
|
|
7839
|
+
"version": "file:../..",
|
|
7840
|
+
"requires": {
|
|
7841
|
+
"@inrupt/oidc-client-ext": "^1.11.7",
|
|
7842
|
+
"@inrupt/solid-client-authn-core": "^1.11.7",
|
|
7843
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
7844
|
+
"@types/jest": "^27.0.3",
|
|
7845
|
+
"@types/lodash.clonedeep": "^4.5.6",
|
|
7846
|
+
"@types/node": "^17.0.2",
|
|
7847
|
+
"@types/uuid": "^8.3.0",
|
|
7848
|
+
"cross-fetch": "^3.0.6",
|
|
7849
|
+
"eslint": "^7.16.0",
|
|
7850
|
+
"events": "^3.3.0",
|
|
7851
|
+
"jest": "^27.5.1",
|
|
7852
|
+
"jose": "^4.3.7",
|
|
7853
|
+
"license-checker": "^25.0.1",
|
|
7854
|
+
"lodash.clonedeep": "^4.5.0",
|
|
7855
|
+
"rollup": "^2.38.4",
|
|
7856
|
+
"rollup-plugin-polyfill-node": "^0.9.0",
|
|
7857
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
7858
|
+
"ts-jest": "^27.0.7",
|
|
7859
|
+
"ts-loader": "^9.1.1",
|
|
7860
|
+
"tsc-watch": "^5.0.2",
|
|
7861
|
+
"typedoc": "^0.22.4",
|
|
7862
|
+
"typedoc-plugin-markdown": "^3.10.2",
|
|
7863
|
+
"typescript": "^4.0.5",
|
|
7864
|
+
"uuid": "^8.3.1"
|
|
7865
|
+
}
|
|
7866
|
+
},
|
|
7800
7867
|
"@nodelib/fs.scandir": {
|
|
7801
7868
|
"version": "2.1.5",
|
|
7802
7869
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
|
@@ -8310,9 +8377,9 @@
|
|
|
8310
8377
|
"dev": true
|
|
8311
8378
|
},
|
|
8312
8379
|
"async": {
|
|
8313
|
-
"version": "2.6.
|
|
8314
|
-
"resolved": "https://registry.npmjs.org/async/-/async-2.6.
|
|
8315
|
-
"integrity": "sha512-
|
|
8380
|
+
"version": "2.6.4",
|
|
8381
|
+
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
|
8382
|
+
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
|
8316
8383
|
"dev": true,
|
|
8317
8384
|
"requires": {
|
|
8318
8385
|
"lodash": "^4.17.14"
|
|
@@ -10044,9 +10111,9 @@
|
|
|
10044
10111
|
}
|
|
10045
10112
|
},
|
|
10046
10113
|
"minimist": {
|
|
10047
|
-
"version": "1.2.
|
|
10048
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
10049
|
-
"integrity": "sha512-
|
|
10114
|
+
"version": "1.2.6",
|
|
10115
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
10116
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
10050
10117
|
"dev": true
|
|
10051
10118
|
},
|
|
10052
10119
|
"mkdirp": {
|
|
@@ -10111,9 +10178,9 @@
|
|
|
10111
10178
|
}
|
|
10112
10179
|
},
|
|
10113
10180
|
"node-forge": {
|
|
10114
|
-
"version": "1.
|
|
10115
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.
|
|
10116
|
-
"integrity": "sha512-
|
|
10181
|
+
"version": "1.3.0",
|
|
10182
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz",
|
|
10183
|
+
"integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==",
|
|
10117
10184
|
"dev": true
|
|
10118
10185
|
},
|
|
10119
10186
|
"node-releases": {
|
|
@@ -8,7 +8,7 @@ import "regenerator-runtime/runtime";
|
|
|
8
8
|
import {
|
|
9
9
|
Session,
|
|
10
10
|
getClientAuthenticationWithDependencies,
|
|
11
|
-
} from "
|
|
11
|
+
} from "@inrupt/solid-client-authn-browser";
|
|
12
12
|
|
|
13
13
|
const clientApplicationName = "S-C-A Browser Demo Client App";
|
|
14
14
|
let snackBarTimeout = undefined;
|
|
@@ -298,6 +298,14 @@ class DemoClientApp extends Component {
|
|
|
298
298
|
|
|
299
299
|
this.setState({ fetchLoading: true });
|
|
300
300
|
|
|
301
|
+
if (this.state.fetchRoute.startsWith("/")) {
|
|
302
|
+
this.setState({
|
|
303
|
+
fetchBody: "Error: please specify a full URL",
|
|
304
|
+
fetchLoading: false,
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
301
309
|
try {
|
|
302
310
|
const session = getSession();
|
|
303
311
|
const response = await (
|
|
@@ -2266,9 +2266,9 @@
|
|
|
2266
2266
|
}
|
|
2267
2267
|
},
|
|
2268
2268
|
"node_modules/async": {
|
|
2269
|
-
"version": "2.6.
|
|
2270
|
-
"resolved": "https://registry.npmjs.org/async/-/async-2.6.
|
|
2271
|
-
"integrity": "sha512-
|
|
2269
|
+
"version": "2.6.4",
|
|
2270
|
+
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
|
2271
|
+
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
|
2272
2272
|
"dev": true,
|
|
2273
2273
|
"dependencies": {
|
|
2274
2274
|
"lodash": "^4.17.14"
|
|
@@ -4461,9 +4461,9 @@
|
|
|
4461
4461
|
}
|
|
4462
4462
|
},
|
|
4463
4463
|
"node_modules/minimist": {
|
|
4464
|
-
"version": "1.2.
|
|
4465
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
4466
|
-
"integrity": "sha512-
|
|
4464
|
+
"version": "1.2.6",
|
|
4465
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
4466
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
4467
4467
|
"dev": true
|
|
4468
4468
|
},
|
|
4469
4469
|
"node_modules/mkdirp": {
|
|
@@ -4529,9 +4529,9 @@
|
|
|
4529
4529
|
}
|
|
4530
4530
|
},
|
|
4531
4531
|
"node_modules/node-forge": {
|
|
4532
|
-
"version": "1.
|
|
4533
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.
|
|
4534
|
-
"integrity": "sha512-
|
|
4532
|
+
"version": "1.3.0",
|
|
4533
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz",
|
|
4534
|
+
"integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==",
|
|
4535
4535
|
"dev": true,
|
|
4536
4536
|
"engines": {
|
|
4537
4537
|
"node": ">= 6.13.0"
|
|
@@ -8059,9 +8059,9 @@
|
|
|
8059
8059
|
"dev": true
|
|
8060
8060
|
},
|
|
8061
8061
|
"async": {
|
|
8062
|
-
"version": "2.6.
|
|
8063
|
-
"resolved": "https://registry.npmjs.org/async/-/async-2.6.
|
|
8064
|
-
"integrity": "sha512-
|
|
8062
|
+
"version": "2.6.4",
|
|
8063
|
+
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
|
8064
|
+
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
|
8065
8065
|
"dev": true,
|
|
8066
8066
|
"requires": {
|
|
8067
8067
|
"lodash": "^4.17.14"
|
|
@@ -9735,9 +9735,9 @@
|
|
|
9735
9735
|
}
|
|
9736
9736
|
},
|
|
9737
9737
|
"minimist": {
|
|
9738
|
-
"version": "1.2.
|
|
9739
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
9740
|
-
"integrity": "sha512-
|
|
9738
|
+
"version": "1.2.6",
|
|
9739
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
9740
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
9741
9741
|
"dev": true
|
|
9742
9742
|
},
|
|
9743
9743
|
"mkdirp": {
|
|
@@ -9794,9 +9794,9 @@
|
|
|
9794
9794
|
}
|
|
9795
9795
|
},
|
|
9796
9796
|
"node-forge": {
|
|
9797
|
-
"version": "1.
|
|
9798
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.
|
|
9799
|
-
"integrity": "sha512-
|
|
9797
|
+
"version": "1.3.0",
|
|
9798
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz",
|
|
9799
|
+
"integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==",
|
|
9800
9800
|
"dev": true
|
|
9801
9801
|
},
|
|
9802
9802
|
"node-releases": {
|
package/jest.config.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
...require("../../jest.config"),
|
|
3
3
|
// Allows running tests from packages/browser/
|
|
4
|
-
testEnvironment: "<rootDir>/../../tests/environment/customEnvironment.js",
|
|
4
|
+
// testEnvironment: "<rootDir>/../../tests/environment/customEnvironment.js",
|
|
5
|
+
testEnvironment: "<rootDir>/../../tests/environment/browserEnvironment.js",
|
|
6
|
+
|
|
7
|
+
// Enable injectGlobals here to support jest-mock-console
|
|
8
|
+
// https://github.com/bpedersen/jest-mock-console/issues/32
|
|
9
|
+
injectGlobals: true,
|
|
5
10
|
};
|
package/package.json
CHANGED
|
@@ -1,60 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inrupt/solid-client-authn-browser",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.8-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "dist/index",
|
|
6
|
-
"browser": "dist/
|
|
6
|
+
"browser": "dist/solid-client-authn.bundle.js",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.es.js",
|
|
8
9
|
"bundle": "dist/solid-client-authn.bundle.js",
|
|
9
10
|
"repository": {
|
|
10
11
|
"url": "https://github.com/inrupt/solid-client-authn"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"prepublishOnly": "npm run build",
|
|
14
|
-
"clean": "
|
|
15
|
-
"
|
|
16
|
-
"clean-browser": "rimraf ./browserDist",
|
|
17
|
-
"build": "npm run build-module && npm run build-browser",
|
|
18
|
-
"build-module": "npm run clean-module && tsc -p tsconfig.json",
|
|
19
|
-
"build-browser": "npm run clean-browser && webpack --config webpack.browser.js",
|
|
15
|
+
"clean": "rimraf ./dist",
|
|
16
|
+
"build": "rollup --config rollup.config.js",
|
|
20
17
|
"lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write",
|
|
21
18
|
"lint:check": "npm run lint:eslint && npm run lint:prettier -- --check",
|
|
22
19
|
"lint:eslint": "eslint --config .eslintrc.js \"src/\"",
|
|
23
20
|
"lint:prettier": "prettier \"src/*.{ts,tsx,js,jsx,css}\" \"**/*.{md,mdx,yml}\"",
|
|
24
21
|
"licenses:check": "license-checker --production --out license.csv --failOn \"AGPL-1.0-only; AGPL-1.0-or-later; AGPL-3.0-only; AGPL-3.0-or-later; Beerware; CC-BY-NC-1.0; CC-BY-NC-2.0; CC-BY-NC-2.5; CC-BY-NC-3.0; CC-BY-NC-4.0; CC-BY-NC-ND-1.0; CC-BY-NC-ND-2.0; CC-BY-NC-ND-2.5; CC-BY-NC-ND-3.0; CC-BY-NC-ND-4.0; CC-BY-NC-SA-1.0; CC-BY-NC-SA-2.0; CC-BY-NC-SA-2.5; CC-BY-NC-SA-3.0; CC-BY-NC-SA-4.0; CPAL-1.0; EUPL-1.0; EUPL-1.1; EUPL-1.1; GPL-1.0-only; GPL-1.0-or-later; GPL-2.0-only; GPL-2.0-or-later; GPL-3.0; GPL-3.0-only; GPL-3.0-or-later; SISSL; SISSL-1.2; WTFPL\"",
|
|
25
22
|
"test": "jest --coverage --verbose",
|
|
26
|
-
"
|
|
23
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest -i",
|
|
24
|
+
"build-api-docs": "typedoc --out docs/api/source/api --readme none",
|
|
27
25
|
"build-docs-preview-site": "npm run build-api-docs; cd docs/api; make html"
|
|
28
26
|
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/jest": "^27.0.3",
|
|
31
|
-
"cross-fetch": "^3.0.6",
|
|
32
|
-
"eslint": "^7.16.0",
|
|
33
|
-
"jest": "^27.5.1",
|
|
34
|
-
"license-checker": "^25.0.1",
|
|
35
|
-
"ts-jest": "^27.0.7",
|
|
36
|
-
"ts-loader": "^9.1.1",
|
|
37
|
-
"tsc-watch": "^4.2.9",
|
|
38
|
-
"typedoc": "^0.22.4",
|
|
39
|
-
"typedoc-plugin-markdown": "^3.10.2",
|
|
40
|
-
"typescript": "^4.0.5",
|
|
41
|
-
"webpack": "^5.11.0",
|
|
42
|
-
"webpack-cli": "^4.2.0",
|
|
43
|
-
"webpack-merge": "^5.7.2"
|
|
44
|
-
},
|
|
45
27
|
"dependencies": {
|
|
46
|
-
"@inrupt/oidc-client-ext": "^1.11.
|
|
47
|
-
"@inrupt/solid-client-authn-core": "^1.11.
|
|
28
|
+
"@inrupt/oidc-client-ext": "^1.11.8-alpha.2",
|
|
29
|
+
"@inrupt/solid-client-authn-core": "^1.11.8-alpha.2",
|
|
48
30
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
49
31
|
"@types/node": "^17.0.2",
|
|
50
32
|
"@types/uuid": "^8.3.0",
|
|
51
33
|
"events": "^3.3.0",
|
|
52
34
|
"jose": "^4.3.7",
|
|
53
35
|
"lodash.clonedeep": "^4.5.0",
|
|
54
|
-
"uuid": "^8.3.
|
|
36
|
+
"uuid": "^8.3.2"
|
|
55
37
|
},
|
|
56
38
|
"publishConfig": {
|
|
57
39
|
"access": "public"
|
|
58
40
|
},
|
|
59
|
-
"
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
43
|
+
"jest-location-mock": "^1.0.9",
|
|
44
|
+
"rollup-plugin-polyfill-node": "^0.9.0",
|
|
45
|
+
"rollup-plugin-sourcemaps": "^0.6.3"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "189b55888fa242a04f54da33dca36f0aca3b7969"
|
|
60
48
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import pkg from "./package.json";
|
|
2
|
+
import typescript from "rollup-plugin-typescript2";
|
|
3
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
4
|
+
import nodePolyfills from "rollup-plugin-polyfill-node";
|
|
5
|
+
import sourcemaps from "rollup-plugin-sourcemaps";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: "./src/index.ts",
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: pkg.main,
|
|
12
|
+
format: "cjs",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
file: pkg.module,
|
|
16
|
+
format: "esm",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
file: pkg.bundle,
|
|
20
|
+
format: "umd",
|
|
21
|
+
name: "solidClientAuthentication",
|
|
22
|
+
globals: {
|
|
23
|
+
// FIXME: inline oidc-client:
|
|
24
|
+
"@inrupt/oidc-client": "oidcClient",
|
|
25
|
+
"@inrupt/solid-client-authn-core": "solidClientAuthnCore",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
plugins: [
|
|
30
|
+
nodePolyfills({
|
|
31
|
+
include: ["events"],
|
|
32
|
+
}),
|
|
33
|
+
sourcemaps(),
|
|
34
|
+
nodeResolve({
|
|
35
|
+
browser: true,
|
|
36
|
+
preferBuiltins: true,
|
|
37
|
+
resolveOnly: [
|
|
38
|
+
"uuid",
|
|
39
|
+
"@inrupt/solid-client-authn-core",
|
|
40
|
+
"@inrupt/oidc-client-ext",
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
typescript({
|
|
44
|
+
// Use our own version of TypeScript, rather than the one bundled with the plugin:
|
|
45
|
+
typescript: require("typescript"),
|
|
46
|
+
tsconfigOverride: {
|
|
47
|
+
compilerOptions: {
|
|
48
|
+
module: "esnext",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
external: ["@inrupt/solid-client", "@inrupt/solid-client-authn-core"],
|
|
54
|
+
// external: ['crypto'],
|
|
55
|
+
// The following option is useful because symlinks are used in monorepos
|
|
56
|
+
preserveSymlinks: true,
|
|
57
|
+
};
|
|
@@ -19,17 +19,19 @@
|
|
|
19
19
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { jest, it, describe, expect } from "@jest/globals";
|
|
22
|
+
import { jest, it, describe, expect, beforeEach } from "@jest/globals";
|
|
23
23
|
import {
|
|
24
24
|
mockStorageUtility,
|
|
25
25
|
StorageUtility,
|
|
26
26
|
USER_SESSION_PREFIX,
|
|
27
27
|
mockStorage,
|
|
28
|
+
EVENTS,
|
|
28
29
|
} from "@inrupt/solid-client-authn-core";
|
|
29
30
|
import * as SolidClientAuthnCore from "@inrupt/solid-client-authn-core";
|
|
30
31
|
import { EventEmitter } from "events";
|
|
31
32
|
import { LoginHandlerMock } from "./login/__mocks__/LoginHandler";
|
|
32
33
|
import {
|
|
34
|
+
RedirectFailureHandlerMock,
|
|
33
35
|
RedirectHandlerMock,
|
|
34
36
|
RedirectHandlerResponse,
|
|
35
37
|
} from "./login/oidc/redirectHandler/__mocks__/RedirectHandler";
|
|
@@ -97,8 +99,43 @@ describe("ClientAuthentication", () => {
|
|
|
97
99
|
);
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
beforeEach(() => {
|
|
103
|
+
jest.clearAllMocks();
|
|
104
|
+
Object.defineProperty(window, "location", {
|
|
105
|
+
writable: true,
|
|
106
|
+
value: { assign: jest.fn() },
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
100
110
|
describe("login", () => {
|
|
101
111
|
const mockEmitter = new EventEmitter();
|
|
112
|
+
// TODO: add tests for events & errors
|
|
113
|
+
|
|
114
|
+
it("calls login, and uses the window.location.href for the redirect if no redirectUrl is set", async () => {
|
|
115
|
+
// Set a current window location which will be the expected URL to be
|
|
116
|
+
// redirected back to, since we don't pass redirectUrl:
|
|
117
|
+
window.location.href = "https://coolapp.test/some/redirect";
|
|
118
|
+
|
|
119
|
+
const clientAuthn = getClientAuthentication();
|
|
120
|
+
await clientAuthn.login(
|
|
121
|
+
{
|
|
122
|
+
sessionId: "mySession",
|
|
123
|
+
tokenType: "DPoP",
|
|
124
|
+
clientId: "coolApp",
|
|
125
|
+
oidcIssuer: "https://idp.com",
|
|
126
|
+
},
|
|
127
|
+
mockEmitter
|
|
128
|
+
);
|
|
129
|
+
expect(defaultMocks.loginHandler.handle).toHaveBeenCalledWith({
|
|
130
|
+
sessionId: "mySession",
|
|
131
|
+
clientId: "coolApp",
|
|
132
|
+
redirectUrl: "https://coolapp.test/some/redirect",
|
|
133
|
+
oidcIssuer: "https://idp.com",
|
|
134
|
+
clientName: "coolApp",
|
|
135
|
+
eventEmitter: mockEmitter,
|
|
136
|
+
tokenType: "DPoP",
|
|
137
|
+
});
|
|
138
|
+
});
|
|
102
139
|
|
|
103
140
|
it("calls login, and defaults to a DPoP token", async () => {
|
|
104
141
|
const clientAuthn = getClientAuthentication();
|
|
@@ -200,6 +237,7 @@ describe("ClientAuthentication", () => {
|
|
|
200
237
|
|
|
201
238
|
describe("logout", () => {
|
|
202
239
|
const mockEmitter = new EventEmitter();
|
|
240
|
+
// TODO: add tests for events & errors
|
|
203
241
|
|
|
204
242
|
it("reverts back to un-authenticated fetch on logout", async () => {
|
|
205
243
|
window.fetch = jest.fn();
|
|
@@ -267,6 +305,7 @@ describe("ClientAuthentication", () => {
|
|
|
267
305
|
|
|
268
306
|
describe("handleIncomingRedirect", () => {
|
|
269
307
|
const mockEmitter = new EventEmitter();
|
|
308
|
+
mockEmitter.emit = jest.fn();
|
|
270
309
|
|
|
271
310
|
it("calls handle redirect", async () => {
|
|
272
311
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -302,6 +341,7 @@ describe("ClientAuthentication", () => {
|
|
|
302
341
|
|
|
303
342
|
// Calling the redirect handler should have updated the fetch.
|
|
304
343
|
expect(clientAuthn.fetch).not.toBe(unauthFetch);
|
|
344
|
+
expect(mockEmitter.emit).not.toHaveBeenCalled();
|
|
305
345
|
});
|
|
306
346
|
|
|
307
347
|
it("clears the current IRI from OAuth query parameters in the auth code flow", async () => {
|
|
@@ -317,6 +357,32 @@ describe("ClientAuthentication", () => {
|
|
|
317
357
|
"",
|
|
318
358
|
"https://coolapp.com/redirect"
|
|
319
359
|
);
|
|
360
|
+
expect(mockEmitter.emit).not.toHaveBeenCalled();
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it("clears the current IRI from OAuth query parameters even if auth flow fails", async () => {
|
|
364
|
+
// eslint-disable-next-line no-restricted-globals
|
|
365
|
+
history.replaceState = jest.fn();
|
|
366
|
+
const clientAuthn = getClientAuthentication({
|
|
367
|
+
...defaultMocks,
|
|
368
|
+
redirectHandler: RedirectFailureHandlerMock,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
const url =
|
|
372
|
+
"https://coolapp.com/redirect?state=someState&code=someAuthCode";
|
|
373
|
+
await clientAuthn.handleIncomingRedirect(url, mockEmitter);
|
|
374
|
+
// eslint-disable-next-line no-restricted-globals
|
|
375
|
+
expect(history.replaceState).toHaveBeenCalledWith(
|
|
376
|
+
null,
|
|
377
|
+
"",
|
|
378
|
+
"https://coolapp.com/redirect"
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
expect(mockEmitter.emit).toHaveBeenCalledWith(
|
|
382
|
+
EVENTS.ERROR,
|
|
383
|
+
"redirect",
|
|
384
|
+
new Error("Something went wrong")
|
|
385
|
+
);
|
|
320
386
|
});
|
|
321
387
|
|
|
322
388
|
it("clears the current IRI from OAuth query parameters in the implicit flow", async () => {
|
|
@@ -332,6 +398,7 @@ describe("ClientAuthentication", () => {
|
|
|
332
398
|
"",
|
|
333
399
|
"https://coolapp.com/redirect"
|
|
334
400
|
);
|
|
401
|
+
expect(mockEmitter.emit).not.toHaveBeenCalled();
|
|
335
402
|
});
|
|
336
403
|
|
|
337
404
|
it("preserves non-OAuth query strings", async () => {
|
|
@@ -347,6 +414,7 @@ describe("ClientAuthentication", () => {
|
|
|
347
414
|
"",
|
|
348
415
|
"https://coolapp.com/redirect?someQuery=someValue"
|
|
349
416
|
);
|
|
417
|
+
expect(mockEmitter.emit).not.toHaveBeenCalled();
|
|
350
418
|
});
|
|
351
419
|
});
|
|
352
420
|
|