@inrupt/solid-client-authn-browser 1.17.1 → 1.17.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/constant.d.ts +2 -2
- package/dist/index.js +50 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -28
- package/dist/index.mjs.map +1 -1
- package/dist/solid-client-authn.bundle.js +7 -7
- package/dist/solid-client-authn.bundle.js.map +1 -1
- package/package.json +6 -6
- package/rollup.config.mjs +1 -1
- package/src/ClientAuthentication.spec.ts +66 -38
- package/src/ClientAuthentication.ts +4 -4
- package/src/Session.spec.ts +44 -44
- package/src/Session.ts +24 -18
- package/src/__mocks__/ClientAuthentication.ts +2 -2
- package/src/defaultSession.ts +4 -3
- package/src/dependencies.ts +5 -5
- package/src/login/oidc/ClientRegistrar.spec.ts +22 -22
- package/src/login/oidc/ClientRegistrar.ts +4 -2
- package/src/login/oidc/IssuerConfigFetcher.spec.ts +25 -25
- package/src/login/oidc/IssuerConfigFetcher.ts +8 -6
- package/src/login/oidc/OidcLoginHandler.spec.ts +15 -15
- package/src/login/oidc/OidcLoginHandler.ts +14 -9
- package/src/login/oidc/Redirector.spec.ts +1 -1
- package/src/login/oidc/__mocks__/ClientRegistrar.ts +3 -3
- package/src/login/oidc/__mocks__/IssuerConfigFetcher.ts +3 -3
- package/src/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.spec.ts +42 -42
- package/src/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.ts +19 -13
- package/src/login/oidc/incomingRedirectHandler/ErrorOidcHandler.spec.ts +12 -12
- package/src/login/oidc/incomingRedirectHandler/ErrorOidcHandler.ts +2 -2
- package/src/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.spec.ts +7 -7
- package/src/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.ts +2 -2
- package/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.spec.ts +17 -17
- package/src/login/oidc/refresh/TokenRefresher.spec.ts +14 -14
- package/src/login/oidc/refresh/TokenRefresher.ts +12 -8
- package/src/login/oidc/refresh/__mocks__/TokenRefresher.ts +1 -1
- package/src/sessionInfo/SessionInfoManager.spec.ts +37 -15
- package/src/sessionInfo/SessionInfoManager.ts +46 -50
- package/src/sessionInfo/__mocks__/SessionInfoManager.ts +3 -3
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ class ClientAuthentication extends ClientAuthentication$1 {
|
|
|
19
19
|
await this.sessionInfoManager.clear(options.sessionId);
|
|
20
20
|
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : removeOidcQueryParam(window.location.href);
|
|
21
21
|
if (!isValidRedirectUrl(redirectUrl)) {
|
|
22
|
-
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI
|
|
22
|
+
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);
|
|
23
23
|
}
|
|
24
24
|
await this.loginHandler.handle({
|
|
25
25
|
...options,
|
|
@@ -82,6 +82,10 @@ class OidcLoginHandler {
|
|
|
82
82
|
this.oidcHandler = oidcHandler;
|
|
83
83
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
84
84
|
this.clientRegistrar = clientRegistrar;
|
|
85
|
+
this.storageUtility = storageUtility;
|
|
86
|
+
this.oidcHandler = oidcHandler;
|
|
87
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
88
|
+
this.clientRegistrar = clientRegistrar;
|
|
85
89
|
}
|
|
86
90
|
async canHandle(options) {
|
|
87
91
|
return hasIssuer(options) && hasRedirectUrl(options);
|
|
@@ -242,6 +246,7 @@ function processConfig(config) {
|
|
|
242
246
|
class IssuerConfigFetcher {
|
|
243
247
|
constructor(storageUtility) {
|
|
244
248
|
this.storageUtility = storageUtility;
|
|
249
|
+
this.storageUtility = storageUtility;
|
|
245
250
|
}
|
|
246
251
|
static getLocalStorageKey(issuer) {
|
|
247
252
|
return `issuerConfig:${issuer}`;
|
|
@@ -267,32 +272,40 @@ async function clear(sessionId, storage) {
|
|
|
267
272
|
}
|
|
268
273
|
class SessionInfoManager extends SessionInfoManagerBase {
|
|
269
274
|
async get(sessionId) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
275
|
+
const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([
|
|
276
|
+
this.storageUtility.getForUser(sessionId, "isLoggedIn", {
|
|
277
|
+
secure: true,
|
|
278
|
+
}),
|
|
279
|
+
this.storageUtility.getForUser(sessionId, "webId", {
|
|
280
|
+
secure: true,
|
|
281
|
+
}),
|
|
282
|
+
this.storageUtility.getForUser(sessionId, "clientId", {
|
|
283
|
+
secure: false,
|
|
284
|
+
}),
|
|
285
|
+
this.storageUtility.getForUser(sessionId, "clientSecret", {
|
|
286
|
+
secure: false,
|
|
287
|
+
}),
|
|
288
|
+
this.storageUtility.getForUser(sessionId, "redirectUrl", {
|
|
289
|
+
secure: false,
|
|
290
|
+
}),
|
|
291
|
+
this.storageUtility.getForUser(sessionId, "refreshToken", {
|
|
292
|
+
secure: true,
|
|
293
|
+
}),
|
|
294
|
+
this.storageUtility.getForUser(sessionId, "issuer", {
|
|
295
|
+
secure: false,
|
|
296
|
+
}),
|
|
297
|
+
this.storageUtility.getForUser(sessionId, "tokenType", {
|
|
298
|
+
secure: false,
|
|
299
|
+
}),
|
|
300
|
+
]);
|
|
301
|
+
if (typeof redirectUrl === "string" && !isValidRedirectUrl(redirectUrl)) {
|
|
302
|
+
await Promise.all([
|
|
303
|
+
this.storageUtility.deleteAllUserData(sessionId, { secure: false }),
|
|
304
|
+
this.storageUtility.deleteAllUserData(sessionId, { secure: true }),
|
|
305
|
+
]);
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
if (tokenType !== undefined && !isSupportedTokenType(tokenType)) {
|
|
296
309
|
throw new Error(`Tokens of type [${tokenType}] are not supported.`);
|
|
297
310
|
}
|
|
298
311
|
if (clientId === undefined &&
|
|
@@ -310,7 +323,7 @@ class SessionInfoManager extends SessionInfoManagerBase {
|
|
|
310
323
|
issuer,
|
|
311
324
|
clientAppId: clientId,
|
|
312
325
|
clientAppSecret: clientSecret,
|
|
313
|
-
tokenType,
|
|
326
|
+
tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP",
|
|
314
327
|
};
|
|
315
328
|
}
|
|
316
329
|
async clear(sessionId) {
|
|
@@ -341,6 +354,11 @@ class AuthCodeRedirectHandler {
|
|
|
341
354
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
342
355
|
this.clientRegistrar = clientRegistrar;
|
|
343
356
|
this.tokerRefresher = tokerRefresher;
|
|
357
|
+
this.storageUtility = storageUtility;
|
|
358
|
+
this.sessionInfoManager = sessionInfoManager;
|
|
359
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
360
|
+
this.clientRegistrar = clientRegistrar;
|
|
361
|
+
this.tokerRefresher = tokerRefresher;
|
|
344
362
|
}
|
|
345
363
|
async canHandle(redirectUrl) {
|
|
346
364
|
try {
|
|
@@ -460,6 +478,7 @@ class Redirector {
|
|
|
460
478
|
class ClientRegistrar {
|
|
461
479
|
constructor(storageUtility) {
|
|
462
480
|
this.storageUtility = storageUtility;
|
|
481
|
+
this.storageUtility = storageUtility;
|
|
463
482
|
}
|
|
464
483
|
async getClient(options, issuerConfig) {
|
|
465
484
|
const [storedClientId, storedClientSecret,] = await Promise.all([
|
|
@@ -525,6 +544,9 @@ class TokenRefresher {
|
|
|
525
544
|
this.storageUtility = storageUtility;
|
|
526
545
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
527
546
|
this.clientRegistrar = clientRegistrar;
|
|
547
|
+
this.storageUtility = storageUtility;
|
|
548
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
549
|
+
this.clientRegistrar = clientRegistrar;
|
|
528
550
|
}
|
|
529
551
|
async refresh(sessionId, refreshToken, dpopKey, eventEmitter) {
|
|
530
552
|
const oidcContext = await loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher);
|