@inrupt/solid-client-authn-browser 2.4.1 → 3.0.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/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/solid-client-authn.bundle.js +2 -2
- package/dist/solid-client-authn.bundle.js.map +1 -1
- package/package.json +5 -5
- package/src/login/oidc/ClientRegistrar.spec.ts +32 -0
- package/src/login/oidc/ClientRegistrar.ts +2 -0
- package/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inrupt/solid-client-authn-browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"build-docs-preview-site": "npm run build-api-docs; cd docs/api; make html"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/node": "^
|
|
29
|
+
"@types/node": "^24.0.7",
|
|
30
30
|
"@types/uuid": "^10.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@inrupt/oidc-client-ext": "^
|
|
34
|
-
"@inrupt/solid-client-authn-core": "^
|
|
33
|
+
"@inrupt/oidc-client-ext": "^3.0.0",
|
|
34
|
+
"@inrupt/solid-client-authn-core": "^3.0.0",
|
|
35
35
|
"events": "^3.3.0",
|
|
36
36
|
"jose": "^5.1.3",
|
|
37
37
|
"uuid": "^11.1.0"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "af698e70dec2fe50f82ec6b85f7192161bbef482"
|
|
43
43
|
}
|
|
@@ -275,6 +275,38 @@ describe("ClientRegistrar", () => {
|
|
|
275
275
|
).toMatchObject(renewedClient);
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
+
it("retrieves client information from storage if they are present and never expire", async () => {
|
|
279
|
+
const clientId = randomUUID();
|
|
280
|
+
const clientSecret = randomUUID();
|
|
281
|
+
const expiresAt = 0;
|
|
282
|
+
const clientRegistrar = getClientRegistrar({
|
|
283
|
+
storage: mockStorageUtility(
|
|
284
|
+
{
|
|
285
|
+
"solidClientAuthenticationUser:mySession": {
|
|
286
|
+
clientId,
|
|
287
|
+
clientSecret,
|
|
288
|
+
expiresAt: String(expiresAt),
|
|
289
|
+
clientType: "dynamic",
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
false,
|
|
293
|
+
),
|
|
294
|
+
});
|
|
295
|
+
const client = await clientRegistrar.getClient(
|
|
296
|
+
{
|
|
297
|
+
sessionId: "mySession",
|
|
298
|
+
redirectUrl: "https://example.com",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
...IssuerConfigFetcherFetchConfigResponse,
|
|
302
|
+
},
|
|
303
|
+
);
|
|
304
|
+
expect(client.clientId).toBe(clientId);
|
|
305
|
+
expect(client.clientSecret).toBe(clientSecret);
|
|
306
|
+
expect(client.clientType).toBe("dynamic");
|
|
307
|
+
expect((client as IOpenIdDynamicClient).expiresAt).toBe(expiresAt);
|
|
308
|
+
});
|
|
309
|
+
|
|
278
310
|
it("saves dynamic registration information", async () => {
|
|
279
311
|
// Setup registration mock.
|
|
280
312
|
const client: IOpenIdDynamicClient = {
|
|
@@ -75,9 +75,11 @@ export default class ClientRegistrar implements IClientRegistrar {
|
|
|
75
75
|
const expirationDate =
|
|
76
76
|
expiresAt !== undefined ? Number.parseInt(expiresAt, 10) : -1;
|
|
77
77
|
// Expiration is only applicable to confidential clients.
|
|
78
|
+
// If the client registration never expires, then the expirationDate is 0.
|
|
78
79
|
// Note that Date.now() is in milliseconds, and expirationDate in seconds.
|
|
79
80
|
const expired =
|
|
80
81
|
storedClientSecret !== undefined &&
|
|
82
|
+
expirationDate !== 0 &&
|
|
81
83
|
Math.floor(Date.now() / 1000) > expirationDate;
|
|
82
84
|
if (storedClientId && isKnownClientType(storedClientType) && !expired) {
|
|
83
85
|
return storedClientSecret !== undefined
|
|
@@ -71,7 +71,7 @@ export default class AuthorizationCodeWithPkceOidcHandler
|
|
|
71
71
|
try {
|
|
72
72
|
const signingRequest = await oidcClientLibrary.createSigninRequest();
|
|
73
73
|
// Make sure to await the promise before returning so that the error is caught.
|
|
74
|
-
return await this.
|
|
74
|
+
return await this.setupRedirectHandler({
|
|
75
75
|
oidcLoginOptions,
|
|
76
76
|
// eslint-disable-next-line no-underscore-dangle
|
|
77
77
|
state: signingRequest.state._id,
|