Skip to content

Commit d87fee1

Browse files
committed
test(plugin-auth): the break-glass pin signs the administrator in through the provider first
Claude-Session: https://claude.ai/code/session_01ADHkmNwrm1hJ9e7eLARM7n Co-authored-by: Claude <noreply@anthropic.com>
1 parent 87aac98 commit d87fee1

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎packages/plugins/plugin-auth/src/sso-oidc-refusal-cause.test.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,15 +798,14 @@ describe('an SSO sign-in grants the permission set its IdP group is mapped to',
798798

799799
it('the break-glass guard still refuses through the sign-in: the last administrator\'s grant is not removed, and the sign-in still lands', async () => {
800800
const rp = await makeGroupRp();
801-
// Mia already exists and is the only administrator, through a grant carrying this provider's marker.
802-
await rp.engine.delete('sys_user', { where: { id: 'usr_admin' } }, SYSTEM as never);
803-
await rp.engine.insert('sys_user', { id: 'usr_mia', email: EMAIL, name: 'Mia Chen', email_verified: true }, SYSTEM);
801+
// Mia is the only administrator, through a grant carrying this provider's marker
802+
// (a row the projection would remove: no mapping names it).
803+
const { userId } = await signInWithClaims(rp, { groups: [] });
804804
await rp.engine.insert('sys_user_permission_set', {
805-
user_id: 'usr_mia', permission_set: ADMIN_FULL_ACCESS, organization_id: DEFAULT_ORG, reason: SSO_MARKER,
805+
user_id: userId, permission_set: ADMIN_FULL_ACCESS, organization_id: DEFAULT_ORG, reason: SSO_MARKER,
806806
}, SYSTEM);
807807

808-
const { userId } = await signInWithClaims(rp, { groups: [] });
809-
expect(userId).toBe('usr_mia');
808+
await signInWithClaims(rp, { groups: [] });
810809
expect(await grantsOf(rp, userId)).toEqual([{ permission_set: ADMIN_FULL_ACCESS, organization_id: DEFAULT_ORG, reason: SSO_MARKER }]);
811810
expect(rp.error).toHaveBeenCalledTimes(1);
812811
expect(String(rp.error.mock.calls[0][0])).toMatch(/applying the provider's IdP group mappings .* FAILED/);

0 commit comments

Comments
 (0)