From 316fdd66fdc8347579df4c18eb8b69c2b9130216 Mon Sep 17 00:00:00 2001 From: Dmitry Gusev Date: Thu, 8 Feb 2024 20:10:25 +0300 Subject: [PATCH 1/2] auth-backend-module-oidc-provider: enable persisted scopes Signed-off-by: Dmitry Gusev --- .../auth-backend-module-oidc-provider/src/authenticator.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/auth-backend-module-oidc-provider/src/authenticator.ts b/plugins/auth-backend-module-oidc-provider/src/authenticator.ts index ba6bc9d142..eddf57a55b 100644 --- a/plugins/auth-backend-module-oidc-provider/src/authenticator.ts +++ b/plugins/auth-backend-module-oidc-provider/src/authenticator.ts @@ -42,6 +42,7 @@ export type OidcAuthResult = { /** @public */ export const oidcAuthenticator = createOAuthAuthenticator({ + shouldPersistScopes: true, defaultProfileTransform: async ( input: OAuthAuthenticatorResult, ) => ({ @@ -162,9 +163,6 @@ export const oidcAuthenticator = createOAuthAuthenticator({ if (!tokenset.access_token) { throw new Error('Refresh failed'); } - if (!tokenset.scope) { - tokenset.scope = input.scope; - } const userinfo = await client.userinfo(tokenset.access_token); return new Promise((resolve, reject) => { From e47189032bec2644b953c21435f3a89ad18acc43 Mon Sep 17 00:00:00 2001 From: Dmitry Gusev Date: Fri, 9 Feb 2024 10:33:46 +0300 Subject: [PATCH 2/2] add changeset Signed-off-by: Dmitry Gusev --- .changeset/eleven-walls-relate.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eleven-walls-relate.md diff --git a/.changeset/eleven-walls-relate.md b/.changeset/eleven-walls-relate.md new file mode 100644 index 0000000000..43c1d5dea9 --- /dev/null +++ b/.changeset/eleven-walls-relate.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend-module-oidc-provider': patch +--- + +Fixed a bug where the OIDC authenticator did not properly persist granted OAuth scopes.