switch omitIdentityTokenOwnershipClaim to true

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-03-18 22:10:50 +01:00
parent 7d86248253
commit d7c67cddf5
5 changed files with 28 additions and 56 deletions
+4 -4
View File
@@ -100,7 +100,7 @@ describe('authPlugin', () => {
const token = refreshRes.body.backstageIdentity.token;
const decoded = JSON.parse(atob(token.split('.')[1]));
expect(decoded.sub).toEqual(expectedIdentity.userEntityRef);
expect(decoded.ent).toEqual(expectedIdentity.ownershipEntityRefs);
expect('ent' in decoded).toBeFalsy();
const userInfoRes = await request(server)
.get('/api/auth/v1/userinfo')
@@ -115,7 +115,7 @@ describe('authPlugin', () => {
});
});
it('should omit ownership claims from the token when the config is set', async () => {
it('should include ownership claims in the token when the config is set to false', async () => {
const { server } = await startTestBackend({
features: [
authPlugin,
@@ -127,7 +127,7 @@ describe('authPlugin', () => {
baseUrl: 'http://localhost',
},
auth: {
omitIdentityTokenOwnershipClaim: true,
omitIdentityTokenOwnershipClaim: false,
...mockProvidersConfig,
},
},
@@ -149,7 +149,7 @@ describe('authPlugin', () => {
const token = refreshRes.body.backstageIdentity.token;
const decoded = JSON.parse(atob(token.split('.')[1]));
expect(decoded.sub).toEqual(expectedIdentity.userEntityRef);
expect(decoded.ent).toBeUndefined();
expect(decoded.ent).toEqual(expectedIdentity.ownershipEntityRefs);
const userInfoRes = await request(server)
.get('/api/auth/v1/userinfo')
+4 -5
View File
@@ -87,11 +87,10 @@ export async function createRouter(
database,
});
const omitClaimsFromToken = config.getOptionalBoolean(
'auth.omitIdentityTokenOwnershipClaim',
)
? ['ent']
: [];
const omitClaimsFromToken =
config.getOptionalBoolean('auth.omitIdentityTokenOwnershipClaim') ?? true
? ['ent']
: [];
let tokenIssuer: TokenIssuer;
if (keyStore instanceof StaticKeyStore) {