Merge pull request #9191 from backstage/auth-backend/full-ref-subs

Auth backend/full ref subs
This commit is contained in:
Ben Lambert
2022-01-27 11:37:36 +01:00
committed by GitHub
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': minor
---
The `sub` claim in Backstage tokens generated by the default Google and OIDC sign-in resolvers are now full entity references of the format `<kind>:<namespace>/<name>`.
@@ -227,7 +227,7 @@ const googleDefaultSignInResolver: SignInResolver<OAuthResult> = async (
}
const token = await ctx.tokenIssuer.issueToken({
claims: { sub: userId, ent: [`user:default/${userId}`] },
claims: { sub: `user:default/${userId}`, ent: [`user:default/${userId}`] },
});
return { id: userId, token };
@@ -221,7 +221,10 @@ export const oAuth2DefaultSignInResolver: SignInResolver<
}
const userId = profile.email.split('@')[0];
const token = await ctx.tokenIssuer.issueToken({
claims: { sub: userId, ent: [`user:default/${userId}`] },
claims: {
sub: `user:default/${userId}`,
ent: [`user:default/${userId}`],
},
});
return { id: userId, token };
};