diff --git a/packages/backend-test-utils/src/next/services/mockCredentials.ts b/packages/backend-test-utils/src/next/services/mockCredentials.ts index 99456e574b..231c108ac4 100644 --- a/packages/backend-test-utils/src/next/services/mockCredentials.ts +++ b/packages/backend-test-utils/src/next/services/mockCredentials.ts @@ -108,7 +108,7 @@ export namespace mockCredentials { */ export function user( userEntityRef: string = DEFAULT_MOCK_USER_ENTITY_REF, - options?: { actor?: string }, + options?: { actor?: { subject: string } }, ): BackstageCredentials { validateUserEntityRef(userEntityRef); return { @@ -134,14 +134,14 @@ export namespace mockCredentials { */ export function token( userEntityRef?: string, - options?: { actor?: string }, + options?: { actor?: { subject: string } }, ): string { if (userEntityRef) { validateUserEntityRef(userEntityRef); return `${MOCK_USER_TOKEN_PREFIX}${JSON.stringify({ sub: userEntityRef, ...(options?.actor && { - actor: options.actor, + actor: { subject: options.actor.subject }, }), } satisfies UserTokenPayload)}`; } diff --git a/plugins/permission-backend/src/service/router.test.ts b/plugins/permission-backend/src/service/router.test.ts index 264a19ccc3..80308d7ca7 100644 --- a/plugins/permission-backend/src/service/router.test.ts +++ b/plugins/permission-backend/src/service/router.test.ts @@ -596,7 +596,7 @@ describe('createRouter', () => { expect(mockApplyConditions).toHaveBeenCalledWith( 'plugin-1', mockCredentials.user('user:default/spiderman', { - actor: 'some-service', + actor: { subject: 'some-service' }, }), [ expect.objectContaining({ @@ -611,7 +611,7 @@ describe('createRouter', () => { expect(mockApplyConditions).toHaveBeenCalledWith( 'plugin-2', mockCredentials.user('user:default/spiderman', { - actor: 'some-service', + actor: { subject: 'some-service' }, }), [ expect.objectContaining({ @@ -729,7 +729,7 @@ describe('createRouter', () => { function userTokenIssuedByService() { return mockCredentials.user.token('user:default/spiderman', { - actor: 'some-service', + actor: { subject: 'some-service' }, }); } });