From 455f309ef4ebd8b89defa99578bc27835d8e9adf Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 14 Sep 2024 11:26:36 +0200 Subject: [PATCH 1/5] Support passing extraQueryParams to the renewTokens method --- src/oidc.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/oidc.ts b/src/oidc.ts index 3618ff1..53bd911 100644 --- a/src/oidc.ts +++ b/src/oidc.ts @@ -66,7 +66,10 @@ export declare namespace Oidc { export type LoggedIn = Record> = Common & { isUserLoggedIn: true; - renewTokens(): Promise; + renewTokens(params?: { + extraQueryParams?: Record; + extraTokenParams?: Record; + }): Promise; getTokens: () => Tokens; subscribeToTokensChange: (onTokenChange: () => void) => { unsubscribe: () => void }; logout: ( @@ -1405,10 +1408,15 @@ export async function createOidc< }); return new Promise(() => {}); }, - "renewTokens": async () => { + "renewTokens": async params => { + const { extraQueryParams, extraTokenParams } = params ?? {}; + assertSessionStorageNotCleared(); - const oidcClientTsUser = await oidcClientTsUserManager.signinSilent(); + const oidcClientTsUser = await oidcClientTsUserManager.signinSilent({ + extraQueryParams, + extraTokenParams + }); assert(oidcClientTsUser !== null); From b9e488111e558cb2f999b1adb9e9db115a2edb78 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 14 Sep 2024 11:27:04 +0200 Subject: [PATCH 2/5] Release candidate --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 83ea8ba..210087c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oidc-spa", - "version": "5.2.8", + "version": "5.3.0-rc.0", "description": "Openidconnect client for Single Page Applications", "repository": { "type": "git", From 29622a9373f422b19f563ce2bf8e4802542b29c8 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 20 Sep 2024 00:16:55 +0200 Subject: [PATCH 3/5] Update to oidc-client-ts v3 --- package.json | 4 ++-- src/tools/decodeJwt.ts | 4 ++-- .../frontend/oidc-client-ts-and-jwt-decode.ts | 2 -- yarn.lock | 24 +++++++------------ 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 210087c..0117f10 100755 --- a/package.json +++ b/package.json @@ -55,11 +55,11 @@ "evt": "^2.5.7", "husky": "^4.3.8", "jsonwebtoken": "^9.0.2", - "jwt-decode": "3.1.2", + "jwt-decode": "4.0.0", "lint-staged": "^11.1.1", "node-fetch": "2.7.0", "@types/node-fetch": "2.6.11", - "oidc-client-ts": "2.4.0", + "oidc-client-ts": "3.0.1", "prettier": "^2.8.8", "react": "^18.2.0", "ts-node": "^10.9.1", diff --git a/src/tools/decodeJwt.ts b/src/tools/decodeJwt.ts index c53f021..7cea3c4 100644 --- a/src/tools/decodeJwt.ts +++ b/src/tools/decodeJwt.ts @@ -1,2 +1,2 @@ -import { jwt_decode } from "../vendor/frontend/oidc-client-ts-and-jwt-decode"; -export const decodeJwt = jwt_decode; +import { jwt_decode_ns } from "../vendor/frontend/oidc-client-ts-and-jwt-decode"; +export const decodeJwt = jwt_decode_ns.jwtDecode; diff --git a/src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts b/src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts index 9f3daac..6642312 100644 --- a/src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts +++ b/src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts @@ -2,5 +2,3 @@ export * from "oidc-client-ts"; import * as jwt_decode_ns from "jwt-decode"; export { jwt_decode_ns }; -import jwt_decode from "jwt-decode"; -export { jwt_decode }; diff --git a/yarn.lock b/yarn.lock index c2d0aaf..5c49a8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1718,11 +1718,6 @@ cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -crypto-js@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" - integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== - csstype@^3.0.2: version "3.1.3" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" @@ -2367,10 +2362,10 @@ jws@^3.2.2: jwa "^1.4.1" safe-buffer "^5.0.1" -jwt-decode@3.1.2, jwt-decode@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" - integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== +jwt-decode@4.0.0, jwt-decode@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-4.0.0.tgz#2270352425fd413785b2faf11f6e755c5151bd4b" + integrity sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA== kind-of@^6.0.2: version "6.0.3" @@ -2609,13 +2604,12 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -oidc-client-ts@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-2.4.0.tgz#764c8a33de542026e2798de9849ce8049047d7e5" - integrity sha512-WijhkTrlXK2VvgGoakWJiBdfIsVGz6CFzgjNNqZU1hPKV2kyeEaJgLs7RwuiSp2WhLfWBQuLvr2SxVlZnk3N1w== +oidc-client-ts@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-3.0.1.tgz#be264fb87c89f74f73863646431c32cd06f5ceb7" + integrity sha512-xX8unZNtmtw3sOz4FPSqDhkLFnxCDsdo2qhFEH2opgWnF/iXMFoYdBQzkwCxAZVgt3FT3DnuBY3k80EZHT0RYg== dependencies: - crypto-js "^4.2.0" - jwt-decode "^3.1.2" + jwt-decode "^4.0.0" once@^1.3.0: version "1.4.0" From 70d0c48b61d5aafaa753e0fd47cfa8eb104b182c Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 20 Sep 2024 00:17:40 +0200 Subject: [PATCH 4/5] Remove extraQueryParams to renewToken method --- src/oidc.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/oidc.ts b/src/oidc.ts index 53bd911..dc0cc68 100644 --- a/src/oidc.ts +++ b/src/oidc.ts @@ -66,10 +66,7 @@ export declare namespace Oidc { export type LoggedIn = Record> = Common & { isUserLoggedIn: true; - renewTokens(params?: { - extraQueryParams?: Record; - extraTokenParams?: Record; - }): Promise; + renewTokens(params?: { extraTokenParams?: Record }): Promise; getTokens: () => Tokens; subscribeToTokensChange: (onTokenChange: () => void) => { unsubscribe: () => void }; logout: ( @@ -1409,12 +1406,11 @@ export async function createOidc< return new Promise(() => {}); }, "renewTokens": async params => { - const { extraQueryParams, extraTokenParams } = params ?? {}; + const { extraTokenParams } = params ?? {}; assertSessionStorageNotCleared(); const oidcClientTsUser = await oidcClientTsUserManager.signinSilent({ - extraQueryParams, extraTokenParams }); From c4d0047c729c2f8cef0ac8e844f160b7690341e7 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 20 Sep 2024 00:18:34 +0200 Subject: [PATCH 5/5] Release candidate --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0117f10..81ba338 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oidc-spa", - "version": "5.3.0-rc.0", + "version": "5.3.0-rc.1", "description": "Openidconnect client for Single Page Applications", "repository": { "type": "git",