chore(core): Adapt OIDC to match SAML behavior for signup (#17234)

This commit is contained in:
Andreas Fitzek
2025-07-11 18:06:42 +02:00
committed by GitHub
parent 6a2edf83ab
commit 7195b3bd97
2 changed files with 21 additions and 9 deletions

View File

@@ -248,7 +248,7 @@ describe('OIDC service', () => {
expect(user.id).toEqual(createdUser.id);
});
it('should throw `BadRequestError` if user already exists out of OIDC system', async () => {
it('should sign up the user if user already exists out of OIDC system', async () => {
const callbackUrl = new URL(
'http://localhost:5678/rest/sso/oidc/callback?code=valid-code&state=valid-state',
);
@@ -279,10 +279,12 @@ describe('OIDC service', () => {
email: 'user1@example.com',
});
await expect(oidcService.loginUser(callbackUrl)).rejects.toThrowError(BadRequestError);
const user = await oidcService.loginUser(callbackUrl);
expect(user).toBeDefined();
expect(user.email).toEqual('user1@example.com');
});
it('should throw `BadRequestError` if OIDC Idp does not have email verified', async () => {
it('should sign in user if OIDC Idp does not have email verified', async () => {
const callbackUrl = new URL(
'http://localhost:5678/rest/sso/oidc/callback?code=valid-code&state=valid-state',
);
@@ -313,7 +315,9 @@ describe('OIDC service', () => {
email: 'user3@example.com',
});
await expect(oidcService.loginUser(callbackUrl)).rejects.toThrowError(BadRequestError);
const user = await oidcService.loginUser(callbackUrl);
expect(user).toBeDefined();
expect(user.email).toEqual('user3@example.com');
});
it('should throw `BadRequestError` if OIDC Idp does not provide an email', async () => {