@inrupt/solid-client-authn-browser 1.16.0 → 1.17.0
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 +4 -13
- package/dist/Session.d.ts +4 -4
- package/dist/dependencies.d.ts +1 -1
- package/dist/index.js +772 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +745 -0
- package/dist/index.mjs.map +1 -0
- package/dist/login/oidc/AggregateOidcHandler.d.ts +2 -1
- package/dist/login/oidc/AggregateRedirectHandler.d.ts +2 -1
- package/dist/login/oidc/ClientRegistrar.d.ts +1 -1
- package/dist/login/oidc/IssuerConfigFetcher.d.ts +1 -1
- package/dist/login/oidc/OidcLoginHandler.d.ts +1 -1
- package/dist/login/oidc/Redirector.d.ts +1 -1
- package/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.d.ts +3 -6
- package/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.d.ts +1 -1
- package/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.d.ts +1 -1
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.d.ts +3 -6
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.d.ts +1 -1
- package/dist/login/oidc/refresh/TokenRefresher.d.ts +2 -2
- package/dist/logout/buildRpInitiatedLogout.d.ts +2 -0
- package/dist/sessionInfo/SessionInfoManager.d.ts +4 -13
- package/dist/solid-client-authn.bundle.js +32 -2
- package/dist/solid-client-authn.bundle.js.map +1 -0
- package/dist/storage/BrowserStorage.d.ts +1 -1
- package/dist/storage/StorageUtility.d.ts +2 -1
- package/package.json +17 -17
- package/rollup.config.mjs +46 -0
- package/src/ClientAuthentication.spec.ts +4 -4
- package/src/ClientAuthentication.ts +8 -45
- package/src/Session.spec.ts +4 -4
- package/src/Session.ts +44 -13
- package/src/__mocks__/ClientAuthentication.ts +3 -3
- package/src/constant.ts +1 -1
- package/src/defaultSession.spec.ts +1 -1
- package/src/defaultSession.ts +5 -3
- package/src/dependencies.node.spec.ts +1 -1
- package/src/dependencies.spec.ts +1 -1
- package/src/dependencies.ts +10 -5
- package/src/index.browser.spec.ts +1 -1
- package/src/index.browser.ts +1 -1
- package/src/index.spec.ts +1 -1
- package/src/index.ts +1 -1
- package/src/login/__mocks__/LoginHandler.ts +2 -2
- package/src/login/oidc/AggregateOidcHandler.spec.ts +3 -5
- package/src/login/oidc/AggregateOidcHandler.ts +3 -3
- package/src/login/oidc/AggregateRedirectHandler.ts +3 -3
- package/src/login/oidc/ClientRegistrar.spec.ts +1 -1
- package/src/login/oidc/ClientRegistrar.ts +2 -2
- package/src/login/oidc/IssuerConfigFetcher.spec.ts +8 -4
- package/src/login/oidc/IssuerConfigFetcher.ts +7 -3
- package/src/login/oidc/OidcLoginHandler.spec.ts +3 -5
- package/src/login/oidc/OidcLoginHandler.ts +5 -3
- package/src/login/oidc/Redirector.spec.ts +1 -1
- package/src/login/oidc/Redirector.ts +2 -2
- package/src/login/oidc/__mocks__/ClientRegistrar.ts +2 -2
- package/src/login/oidc/__mocks__/IOidcHandler.ts +2 -2
- package/src/login/oidc/__mocks__/IOidcOptions.ts +2 -2
- package/src/login/oidc/__mocks__/IssuerConfigFetcher.ts +2 -2
- package/src/login/oidc/__mocks__/Redirector.ts +2 -2
- package/src/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.spec.ts +37 -39
- package/src/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.ts +17 -13
- package/src/login/oidc/incomingRedirectHandler/ErrorOidcHandler.spec.ts +3 -4
- package/src/login/oidc/incomingRedirectHandler/ErrorOidcHandler.ts +3 -3
- package/src/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.spec.ts +3 -4
- package/src/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.ts +2 -2
- package/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.spec.ts +3 -3
- package/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.ts +13 -51
- package/src/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.ts +2 -2
- package/src/login/oidc/refresh/TokenRefresher.spec.ts +7 -6
- package/src/login/oidc/refresh/TokenRefresher.ts +6 -4
- package/src/login/oidc/refresh/__mocks__/TokenRefresher.ts +2 -2
- package/src/logout/{GeneralLogoutHandler.ts → buildRpInitiatedLogout.ts} +21 -20
- package/src/sessionInfo/SessionInfoManager.spec.ts +2 -2
- package/src/sessionInfo/SessionInfoManager.ts +13 -91
- package/src/sessionInfo/__mocks__/SessionInfoManager.ts +2 -2
- package/src/storage/BrowserStorage.spec.ts +1 -1
- package/src/storage/BrowserStorage.ts +2 -2
- package/src/storage/StorageUtility.ts +3 -2
- package/src/storage/__mocks__/LocalStorage.ts +1 -1
- package/src/util/UUIDGenerator.spec.ts +1 -1
- package/src/util/UuidGenerator.ts +1 -1
- package/src/util/__mocks__/UuidGenerator.ts +2 -2
- package/dist/ClientAuthentication.js +0 -80
- package/dist/ClientAuthentication.js.map +0 -1
- package/dist/Session.js +0 -150
- package/dist/Session.js.map +0 -1
- package/dist/constant.js +0 -7
- package/dist/constant.js.map +0 -1
- package/dist/defaultSession.js +0 -52
- package/dist/defaultSession.js.map +0 -1
- package/dist/dependencies.js +0 -41
- package/dist/dependencies.js.map +0 -1
- package/dist/index.browser.js +0 -28
- package/dist/index.browser.js.map +0 -1
- package/dist/login/oidc/AggregateOidcHandler.js +0 -10
- package/dist/login/oidc/AggregateOidcHandler.js.map +0 -1
- package/dist/login/oidc/AggregateRedirectHandler.js +0 -10
- package/dist/login/oidc/AggregateRedirectHandler.js.map +0 -1
- package/dist/login/oidc/ClientRegistrar.js +0 -47
- package/dist/login/oidc/ClientRegistrar.js.map +0 -1
- package/dist/login/oidc/IssuerConfigFetcher.js +0 -124
- package/dist/login/oidc/IssuerConfigFetcher.js.map +0 -1
- package/dist/login/oidc/OidcLoginHandler.js +0 -40
- package/dist/login/oidc/OidcLoginHandler.js.map +0 -1
- package/dist/login/oidc/Redirector.js +0 -17
- package/dist/login/oidc/Redirector.js.map +0 -1
- package/dist/login/oidc/__mocks__/IOidcOptions.d.ts +0 -2
- package/dist/login/oidc/__mocks__/IOidcOptions.js +0 -25
- package/dist/login/oidc/__mocks__/IOidcOptions.js.map +0 -1
- package/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js +0 -91
- package/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js.map +0 -1
- package/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js +0 -26
- package/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js.map +0 -1
- package/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js +0 -20
- package/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js.map +0 -1
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js +0 -56
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js.map +0 -1
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js +0 -47
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js.map +0 -1
- package/dist/login/oidc/refresh/TokenRefresher.js +0 -31
- package/dist/login/oidc/refresh/TokenRefresher.js.map +0 -1
- package/dist/logout/GeneralLogoutHandler.d.ts +0 -7
- package/dist/logout/GeneralLogoutHandler.js +0 -15
- package/dist/logout/GeneralLogoutHandler.js.map +0 -1
- package/dist/sessionInfo/SessionInfoManager.js +0 -96
- package/dist/sessionInfo/SessionInfoManager.js.map +0 -1
- package/dist/solid-client-authn.bundle.js.LICENSE.txt +0 -17
- package/dist/storage/BrowserStorage.js +0 -18
- package/dist/storage/BrowserStorage.js.map +0 -1
- package/dist/storage/StorageUtility.js +0 -10
- package/dist/storage/StorageUtility.js.map +0 -1
- package/dist/util/UuidGenerator.js +0 -10
- package/dist/util/UuidGenerator.js.map +0 -1
- package/licenses.csv +0 -147
- package/src/logout/GeneralLogoutHandler.spec.ts +0 -72
- package/src/logout/__mocks__/LogoutHandler.ts +0 -38
- package/webpack.browser.js +0 -39
- package/webpack.common.js +0 -42
- package/webpack.config.js +0 -28
- package/webpack.dev.js +0 -37
- package/webpack.prod.js +0 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
//
|
|
21
21
|
|
|
22
22
|
import { jest, it, describe, expect } from "@jest/globals";
|
|
23
|
-
import {
|
|
24
|
-
EVENTS,
|
|
23
|
+
import type {
|
|
25
24
|
KeyPair,
|
|
26
25
|
TokenEndpointResponse,
|
|
27
26
|
} from "@inrupt/solid-client-authn-core";
|
|
27
|
+
import { EVENTS } from "@inrupt/solid-client-authn-core";
|
|
28
28
|
import {
|
|
29
29
|
StorageUtilityMock,
|
|
30
30
|
mockStorageUtility,
|
|
31
31
|
} from "@inrupt/solid-client-authn-core/mocks";
|
|
32
|
-
import { JWK
|
|
33
|
-
import {
|
|
32
|
+
import type { JWK } from "jose";
|
|
33
|
+
import { importJWK } from "jose";
|
|
34
|
+
import type { refresh } from "@inrupt/oidc-client-ext";
|
|
34
35
|
import { EventEmitter } from "events";
|
|
35
|
-
import { KeyObject } from "crypto";
|
|
36
|
+
import type { KeyObject } from "crypto";
|
|
36
37
|
import TokenRefresher from "./TokenRefresher";
|
|
37
38
|
import {
|
|
38
39
|
mockDefaultIssuerConfigFetcher,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,19 +24,21 @@
|
|
|
24
24
|
* @packageDocumentation
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import type {
|
|
28
28
|
IClient,
|
|
29
29
|
IClientRegistrar,
|
|
30
30
|
IIssuerConfigFetcher,
|
|
31
31
|
IStorageUtility,
|
|
32
|
-
loadOidcContextFromStorage,
|
|
33
32
|
KeyPair,
|
|
34
33
|
ITokenRefresher,
|
|
35
34
|
TokenEndpointResponse,
|
|
35
|
+
} from "@inrupt/solid-client-authn-core";
|
|
36
|
+
import {
|
|
37
|
+
loadOidcContextFromStorage,
|
|
36
38
|
EVENTS,
|
|
37
39
|
} from "@inrupt/solid-client-authn-core";
|
|
38
40
|
import { refresh } from "@inrupt/oidc-client-ext";
|
|
39
|
-
import { EventEmitter } from "events";
|
|
41
|
+
import type { EventEmitter } from "events";
|
|
40
42
|
|
|
41
43
|
// Some identifiers are not in camelcase on purpose, as they are named using the
|
|
42
44
|
// official names from the OIDC/OAuth2 specifications.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
|
|
22
22
|
import { jest } from "@jest/globals";
|
|
23
|
-
import {
|
|
23
|
+
import type {
|
|
24
24
|
ITokenRefresher,
|
|
25
25
|
TokenEndpointResponse,
|
|
26
26
|
} from "@inrupt/solid-client-authn-core";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -18,28 +18,29 @@
|
|
|
18
18
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
19
19
|
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* @packageDocumentation
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
ILogoutHandler,
|
|
29
|
-
ISessionInfoManager,
|
|
21
|
+
import type {
|
|
22
|
+
IEndSessionOptions,
|
|
23
|
+
IRpLogoutOptions,
|
|
30
24
|
} from "@inrupt/solid-client-authn-core";
|
|
25
|
+
import { getEndSessionUrl } from "@inrupt/solid-client-authn-core";
|
|
31
26
|
|
|
32
27
|
/**
|
|
28
|
+
* @param options.endSessionEndpoint The end_session_endpoint advertised by the server
|
|
29
|
+
* @param options.idTokenHint The idToken supplied by the server after logging in
|
|
30
|
+
* Redirects the window to the location required to perform RP initiated logout
|
|
31
|
+
*
|
|
33
32
|
* @hidden
|
|
34
33
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
export function buildRpInitiatedLogout({
|
|
35
|
+
endSessionEndpoint,
|
|
36
|
+
idTokenHint,
|
|
37
|
+
}: Omit<IEndSessionOptions, keyof IRpLogoutOptions>) {
|
|
38
|
+
return function logout({ state, postLogoutUrl }: IRpLogoutOptions) {
|
|
39
|
+
window.location.href = getEndSessionUrl({
|
|
40
|
+
endSessionEndpoint,
|
|
41
|
+
idTokenHint,
|
|
42
|
+
state,
|
|
43
|
+
postLogoutRedirectUri: postLogoutUrl,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
45
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
StorageUtility,
|
|
25
25
|
mockStorage,
|
|
26
26
|
} from "@inrupt/solid-client-authn-core";
|
|
27
|
+
import { mockLogoutHandler } from "@inrupt/solid-client-authn-core/mocks";
|
|
27
28
|
import { jest, it, describe, expect } from "@jest/globals";
|
|
28
29
|
|
|
29
30
|
import { UuidGeneratorMock } from "../util/__mocks__/UuidGenerator";
|
|
30
|
-
import { mockLogoutHandler } from "../logout/__mocks__/LogoutHandler";
|
|
31
31
|
import { SessionInfoManager } from "./SessionInfoManager";
|
|
32
32
|
|
|
33
33
|
const mockClearFunction = jest.fn();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,27 +24,20 @@
|
|
|
24
24
|
* @packageDocumentation
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import type {
|
|
28
28
|
ISessionInfo,
|
|
29
29
|
ISessionInfoManager,
|
|
30
30
|
ISessionInternalInfo,
|
|
31
|
-
ISessionInfoManagerOptions,
|
|
32
31
|
IStorageUtility,
|
|
32
|
+
} from "@inrupt/solid-client-authn-core";
|
|
33
|
+
import {
|
|
33
34
|
isSupportedTokenType,
|
|
35
|
+
clear as clearBase,
|
|
36
|
+
SessionInfoManagerBase,
|
|
34
37
|
} from "@inrupt/solid-client-authn-core";
|
|
35
|
-
import { v4 } from "uuid";
|
|
36
38
|
import { clearOidcPersistentStorage } from "@inrupt/oidc-client-ext";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export function getUnauthenticatedSession(): ISessionInfo & {
|
|
40
|
-
fetch: typeof fetch;
|
|
41
|
-
} {
|
|
42
|
-
return {
|
|
43
|
-
isLoggedIn: false,
|
|
44
|
-
sessionId: v4(),
|
|
45
|
-
fetch,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
39
|
+
|
|
40
|
+
export { getUnauthenticatedSession } from "@inrupt/solid-client-authn-core";
|
|
48
41
|
|
|
49
42
|
/**
|
|
50
43
|
* @param sessionId
|
|
@@ -55,60 +48,17 @@ export async function clear(
|
|
|
55
48
|
sessionId: string,
|
|
56
49
|
storage: IStorageUtility
|
|
57
50
|
): Promise<void> {
|
|
58
|
-
await
|
|
59
|
-
storage.deleteAllUserData(sessionId, { secure: false }),
|
|
60
|
-
storage.deleteAllUserData(sessionId, { secure: true }),
|
|
61
|
-
// FIXME: This is needed until the DPoP key is stored safely
|
|
62
|
-
storage.delete("clientKey", { secure: false }),
|
|
63
|
-
]);
|
|
51
|
+
await clearBase(sessionId, storage);
|
|
64
52
|
await clearOidcPersistentStorage();
|
|
65
53
|
}
|
|
66
54
|
|
|
67
55
|
/**
|
|
68
56
|
* @hidden
|
|
69
57
|
*/
|
|
70
|
-
export class SessionInfoManager
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
update(
|
|
75
|
-
_sessionId: string,
|
|
76
|
-
_options: ISessionInfoManagerOptions
|
|
77
|
-
): Promise<void> {
|
|
78
|
-
// const localUserId: string = options.localUserId || this.uuidGenerator.v4();
|
|
79
|
-
// if (options.loggedIn) {
|
|
80
|
-
// return {
|
|
81
|
-
// sessionId,
|
|
82
|
-
// loggedIn: true,
|
|
83
|
-
// webId: options.webId as string,
|
|
84
|
-
// neededAction: options.neededAction || { actionType: "inaction" },
|
|
85
|
-
// state: options.state,
|
|
86
|
-
// logout: async (): Promise<void> => {
|
|
87
|
-
// // TODO: handle if webid isn't here
|
|
88
|
-
// return this.logoutHandler.handle(localUserId);
|
|
89
|
-
// },
|
|
90
|
-
// fetch: (url: RequestInfo, init?: RequestInit): Promise<Response> => {
|
|
91
|
-
// // TODO: handle if webid isn't here
|
|
92
|
-
// return this.authenticatedFetcher.handle(
|
|
93
|
-
// {
|
|
94
|
-
// localUserId,
|
|
95
|
-
// type: "dpop"
|
|
96
|
-
// },
|
|
97
|
-
// url,
|
|
98
|
-
// init
|
|
99
|
-
// );
|
|
100
|
-
// }
|
|
101
|
-
// };
|
|
102
|
-
// } else {
|
|
103
|
-
// return {
|
|
104
|
-
// localUserId,
|
|
105
|
-
// loggedIn: false,
|
|
106
|
-
// neededAction: options.neededAction || { actionType: "inaction" }
|
|
107
|
-
// };
|
|
108
|
-
// }
|
|
109
|
-
throw new Error("Not Implemented");
|
|
110
|
-
}
|
|
111
|
-
|
|
58
|
+
export class SessionInfoManager
|
|
59
|
+
extends SessionInfoManagerBase
|
|
60
|
+
implements ISessionInfoManager
|
|
61
|
+
{
|
|
112
62
|
async get(
|
|
113
63
|
sessionId: string
|
|
114
64
|
): Promise<(ISessionInfo & ISessionInternalInfo) | undefined> {
|
|
@@ -191,11 +141,6 @@ export class SessionInfoManager implements ISessionInfoManager {
|
|
|
191
141
|
};
|
|
192
142
|
}
|
|
193
143
|
|
|
194
|
-
// eslint-disable-next-line class-methods-use-this
|
|
195
|
-
async getAll(): Promise<(ISessionInfo & ISessionInternalInfo)[]> {
|
|
196
|
-
throw new Error("Not implemented");
|
|
197
|
-
}
|
|
198
|
-
|
|
199
144
|
/**
|
|
200
145
|
* This function removes all session-related information from storage.
|
|
201
146
|
* @param sessionId the session identifier
|
|
@@ -205,27 +150,4 @@ export class SessionInfoManager implements ISessionInfoManager {
|
|
|
205
150
|
async clear(sessionId: string): Promise<void> {
|
|
206
151
|
return clear(sessionId, this.storageUtility);
|
|
207
152
|
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Registers a new session, so that its ID can be retrieved.
|
|
211
|
-
* @param sessionId
|
|
212
|
-
*/
|
|
213
|
-
async register(_sessionId: string): Promise<void> {
|
|
214
|
-
throw new Error("Not implemented");
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Returns all the registered session IDs. Differs from getAll, which also
|
|
219
|
-
* returns additional session information.
|
|
220
|
-
*/
|
|
221
|
-
async getRegisteredSessionIdAll(): Promise<string[]> {
|
|
222
|
-
throw new Error("Not implemented");
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Deletes all information about all sessions, including their registrations.
|
|
227
|
-
*/
|
|
228
|
-
async clearAll(): Promise<void> {
|
|
229
|
-
throw new Error("Not implemented");
|
|
230
|
-
}
|
|
231
153
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
//
|
|
21
21
|
|
|
22
|
-
import {
|
|
22
|
+
import type {
|
|
23
23
|
ISessionInfo,
|
|
24
24
|
ISessionInfoManager,
|
|
25
25
|
ISessionInfoManagerOptions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @packageDocumentation
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { IStorage } from "@inrupt/solid-client-authn-core";
|
|
27
|
+
import type { IStorage } from "@inrupt/solid-client-authn-core";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* @hidden
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* A helper class that will validate items taken from local storage
|
|
29
29
|
*/
|
|
30
|
-
import { IStorage
|
|
30
|
+
import type { IStorage } from "@inrupt/solid-client-authn-core";
|
|
31
|
+
import { StorageUtility } from "@inrupt/solid-client-authn-core";
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* This class in a no-value-added extension of StorageUtility from the core module.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright Inrupt Inc.
|
|
3
3
|
//
|
|
4
4
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
// of this software and associated documentation files (the "Software"), to deal in
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
|
|
22
22
|
import { jest } from "@jest/globals";
|
|
23
|
-
import { IUuidGenerator } from "../UuidGenerator";
|
|
23
|
+
import type { IUuidGenerator } from "../UuidGenerator";
|
|
24
24
|
|
|
25
25
|
export const UuidGeneratorMockResponse = "fee3fa53-a6a9-475c-a0da-b1343a4fff76";
|
|
26
26
|
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const solid_client_authn_core_1 = require("@inrupt/solid-client-authn-core");
|
|
4
|
-
const universal_fetch_1 = require("@inrupt/universal-fetch");
|
|
5
|
-
const oidc_client_ext_1 = require("@inrupt/oidc-client-ext");
|
|
6
|
-
const globalFetch = (request, init) => (0, universal_fetch_1.fetch)(request, init);
|
|
7
|
-
class ClientAuthentication {
|
|
8
|
-
constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
|
|
9
|
-
this.loginHandler = loginHandler;
|
|
10
|
-
this.redirectHandler = redirectHandler;
|
|
11
|
-
this.logoutHandler = logoutHandler;
|
|
12
|
-
this.sessionInfoManager = sessionInfoManager;
|
|
13
|
-
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
14
|
-
this.login = async (options, eventEmitter) => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
await this.sessionInfoManager.clear(options.sessionId);
|
|
17
|
-
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : (0, oidc_client_ext_1.removeOidcQueryParam)(window.location.href);
|
|
18
|
-
if (!(0, solid_client_authn_core_1.isValidRedirectUrl)(redirectUrl)) {
|
|
19
|
-
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI or it includes a hash fragment.`);
|
|
20
|
-
}
|
|
21
|
-
await this.loginHandler.handle({
|
|
22
|
-
...options,
|
|
23
|
-
redirectUrl,
|
|
24
|
-
clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
|
|
25
|
-
eventEmitter,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
this.fetch = globalFetch;
|
|
29
|
-
this.logout = async (sessionId) => {
|
|
30
|
-
await this.logoutHandler.handle(sessionId);
|
|
31
|
-
this.fetch = globalFetch;
|
|
32
|
-
};
|
|
33
|
-
this.getSessionInfo = async (sessionId) => {
|
|
34
|
-
return this.sessionInfoManager.get(sessionId);
|
|
35
|
-
};
|
|
36
|
-
this.getAllSessionInfo = async () => {
|
|
37
|
-
return this.sessionInfoManager.getAll();
|
|
38
|
-
};
|
|
39
|
-
this.validateCurrentSession = async (currentSessionId) => {
|
|
40
|
-
const sessionInfo = await this.sessionInfoManager.get(currentSessionId);
|
|
41
|
-
if (sessionInfo === undefined ||
|
|
42
|
-
sessionInfo.clientAppId === undefined ||
|
|
43
|
-
sessionInfo.issuer === undefined) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return sessionInfo;
|
|
47
|
-
};
|
|
48
|
-
this.handleIncomingRedirect = async (url, eventEmitter) => {
|
|
49
|
-
try {
|
|
50
|
-
const redirectInfo = await this.redirectHandler.handle(url, eventEmitter);
|
|
51
|
-
this.fetch = redirectInfo.fetch.bind(window);
|
|
52
|
-
this.cleanUrlAfterRedirect(url);
|
|
53
|
-
return {
|
|
54
|
-
isLoggedIn: redirectInfo.isLoggedIn,
|
|
55
|
-
webId: redirectInfo.webId,
|
|
56
|
-
sessionId: redirectInfo.sessionId,
|
|
57
|
-
expirationDate: redirectInfo.expirationDate,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
this.cleanUrlAfterRedirect(url);
|
|
62
|
-
eventEmitter.emit(solid_client_authn_core_1.EVENTS.ERROR, "redirect", err);
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
cleanUrlAfterRedirect(url) {
|
|
68
|
-
const cleanedUpUrl = new URL(url);
|
|
69
|
-
cleanedUpUrl.searchParams.delete("state");
|
|
70
|
-
cleanedUpUrl.searchParams.delete("code");
|
|
71
|
-
cleanedUpUrl.searchParams.delete("id_token");
|
|
72
|
-
cleanedUpUrl.searchParams.delete("access_token");
|
|
73
|
-
cleanedUpUrl.searchParams.delete("error");
|
|
74
|
-
cleanedUpUrl.searchParams.delete("error_description");
|
|
75
|
-
cleanedUpUrl.searchParams.delete("iss");
|
|
76
|
-
window.history.replaceState(null, "", cleanedUpUrl.toString());
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.default = ClientAuthentication;
|
|
80
|
-
//# sourceMappingURL=ClientAuthentication.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientAuthentication.js","sourceRoot":"","sources":["../src/ClientAuthentication.ts"],"names":[],"mappings":";;AA0BA,6EAWyC;AACzC,6DAAgD;AAChD,6DAA+D;AAM/D,MAAM,WA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CAAC;IAkHI,qBAAqB,CAAC,GAAW;QACvC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE1C,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEzC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7C,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEjD,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACtD,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAOxC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AA7ID,uCA6IC"}
|
package/dist/Session.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Session = exports.silentlyAuthenticate = void 0;
|
|
7
|
-
const solid_client_authn_core_1 = require("@inrupt/solid-client-authn-core");
|
|
8
|
-
const uuid_1 = require("uuid");
|
|
9
|
-
const events_1 = __importDefault(require("events"));
|
|
10
|
-
const dependencies_1 = require("./dependencies");
|
|
11
|
-
const constant_1 = require("./constant");
|
|
12
|
-
async function silentlyAuthenticate(sessionId, clientAuthn, session) {
|
|
13
|
-
var _a;
|
|
14
|
-
const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);
|
|
15
|
-
if (storedSessionInfo !== null) {
|
|
16
|
-
window.localStorage.setItem(constant_1.KEY_CURRENT_URL, window.location.href);
|
|
17
|
-
await clientAuthn.login({
|
|
18
|
-
sessionId,
|
|
19
|
-
prompt: "none",
|
|
20
|
-
oidcIssuer: storedSessionInfo.issuer,
|
|
21
|
-
redirectUrl: storedSessionInfo.redirectUrl,
|
|
22
|
-
clientId: storedSessionInfo.clientAppId,
|
|
23
|
-
clientSecret: storedSessionInfo.clientAppSecret,
|
|
24
|
-
tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
|
|
25
|
-
}, session.events);
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
exports.silentlyAuthenticate = silentlyAuthenticate;
|
|
31
|
-
function isLoggedIn(sessionInfo) {
|
|
32
|
-
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
33
|
-
}
|
|
34
|
-
class Session extends events_1.default {
|
|
35
|
-
constructor(sessionOptions = {}, sessionId = undefined) {
|
|
36
|
-
super();
|
|
37
|
-
this.tokenRequestInProgress = false;
|
|
38
|
-
this.login = async (options) => {
|
|
39
|
-
var _a;
|
|
40
|
-
await this.clientAuthentication.login({
|
|
41
|
-
sessionId: this.info.sessionId,
|
|
42
|
-
...options,
|
|
43
|
-
tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
|
|
44
|
-
}, this.events);
|
|
45
|
-
return new Promise(() => { });
|
|
46
|
-
};
|
|
47
|
-
this.fetch = async (url, init) => {
|
|
48
|
-
return this.clientAuthentication.fetch(url, init);
|
|
49
|
-
};
|
|
50
|
-
this.internalLogout = async (emitSignal) => {
|
|
51
|
-
window.localStorage.removeItem(constant_1.KEY_CURRENT_SESSION);
|
|
52
|
-
await this.clientAuthentication.logout(this.info.sessionId);
|
|
53
|
-
this.info.isLoggedIn = false;
|
|
54
|
-
if (emitSignal) {
|
|
55
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.LOGOUT);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
this.logout = async () => this.internalLogout(true);
|
|
59
|
-
this.handleIncomingRedirect = async (inputOptions = {}) => {
|
|
60
|
-
var _a;
|
|
61
|
-
if (this.info.isLoggedIn) {
|
|
62
|
-
return this.info;
|
|
63
|
-
}
|
|
64
|
-
if (this.tokenRequestInProgress) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions;
|
|
68
|
-
const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;
|
|
69
|
-
this.tokenRequestInProgress = true;
|
|
70
|
-
const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);
|
|
71
|
-
if (isLoggedIn(sessionInfo)) {
|
|
72
|
-
this.setSessionInfo(sessionInfo);
|
|
73
|
-
const currentUrl = window.localStorage.getItem(constant_1.KEY_CURRENT_URL);
|
|
74
|
-
if (currentUrl === null) {
|
|
75
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.LOGIN);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
window.localStorage.removeItem(constant_1.KEY_CURRENT_URL);
|
|
79
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, currentUrl);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else if (options.restorePreviousSession === true) {
|
|
83
|
-
const storedSessionId = window.localStorage.getItem(constant_1.KEY_CURRENT_SESSION);
|
|
84
|
-
if (storedSessionId !== null) {
|
|
85
|
-
const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);
|
|
86
|
-
if (attemptedSilentAuthentication) {
|
|
87
|
-
return new Promise(() => { });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this.tokenRequestInProgress = false;
|
|
92
|
-
return sessionInfo;
|
|
93
|
-
};
|
|
94
|
-
this.events = new Proxy(this, (0, solid_client_authn_core_1.buildProxyHandler)(Session.prototype, "events only implements ISessionEventListener"));
|
|
95
|
-
if (sessionOptions.clientAuthentication) {
|
|
96
|
-
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
97
|
-
}
|
|
98
|
-
else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
99
|
-
this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({
|
|
100
|
-
secureStorage: sessionOptions.secureStorage,
|
|
101
|
-
insecureStorage: sessionOptions.insecureStorage,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({});
|
|
106
|
-
}
|
|
107
|
-
if (sessionOptions.sessionInfo) {
|
|
108
|
-
this.info = {
|
|
109
|
-
sessionId: sessionOptions.sessionInfo.sessionId,
|
|
110
|
-
isLoggedIn: false,
|
|
111
|
-
webId: sessionOptions.sessionInfo.webId,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
this.info = {
|
|
116
|
-
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : (0, uuid_1.v4)(),
|
|
117
|
-
isLoggedIn: false,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, () => window.localStorage.setItem(constant_1.KEY_CURRENT_SESSION, this.info.sessionId));
|
|
121
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
122
|
-
this.events.on(solid_client_authn_core_1.EVENTS.ERROR, () => this.internalLogout(false));
|
|
123
|
-
}
|
|
124
|
-
onLogin(callback) {
|
|
125
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, callback);
|
|
126
|
-
}
|
|
127
|
-
onLogout(callback) {
|
|
128
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGOUT, callback);
|
|
129
|
-
}
|
|
130
|
-
onError(callback) {
|
|
131
|
-
this.events.on(solid_client_authn_core_1.EVENTS.ERROR, callback);
|
|
132
|
-
}
|
|
133
|
-
onSessionRestore(callback) {
|
|
134
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, callback);
|
|
135
|
-
}
|
|
136
|
-
onSessionExpiration(callback) {
|
|
137
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, callback);
|
|
138
|
-
}
|
|
139
|
-
setSessionInfo(sessionInfo) {
|
|
140
|
-
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
141
|
-
this.info.webId = sessionInfo.webId;
|
|
142
|
-
this.info.sessionId = sessionInfo.sessionId;
|
|
143
|
-
this.info.expirationDate = sessionInfo.expirationDate;
|
|
144
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXTENDED, (expiresIn) => {
|
|
145
|
-
this.info.expirationDate = Date.now() + expiresIn * 1000;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.Session = Session;
|
|
150
|
-
//# sourceMappingURL=Session.js.map
|
package/dist/Session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":";;;;;;AAwBA,6EAQyC;AAEzC,+BAA0B;AAC1B,oDAAkC;AAElC,iDAAyE;AACzE,yCAAkE;AA8D3D,KAAK,UAAU,oBAAoB,CACxC,SAAiB,EACjB,WAAiC,EACjC,OAAgB;;IAEhB,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC9E,IAAI,iBAAiB,KAAK,IAAI,EAAE;QAK9B,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,0BAAe,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnE,MAAM,WAAW,CAAC,KAAK,CACrB;YACE,SAA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AAM,CAAC,EAAE,CAAC,gCAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IASD,mBAAmB,CAAC,QAAuB;QACzC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,gCAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAEO,cAAc,CACpB,WAAgD;QAEhD,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,gCAAM,CAAC,gBAAgB,EAAE,CAAC,SAAiB,EAAE,EAAE;YAC5D,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5RD,0BA4RC"}
|
package/dist/constant.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KEY_CURRENT_URL = exports.KEY_CURRENT_SESSION = void 0;
|
|
4
|
-
const solid_client_authn_core_1 = require("@inrupt/solid-client-authn-core");
|
|
5
|
-
exports.KEY_CURRENT_SESSION = `${solid_client_authn_core_1.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;
|
|
6
|
-
exports.KEY_CURRENT_URL = `${solid_client_authn_core_1.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;
|
|
7
|
-
//# sourceMappingURL=constant.js.map
|