feat(auth): add WorkOS and Keycloak SSO providers (rebased) (#220)
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #220.
This commit is contained in:
40
apps/gateway/src/auth/sso.controller.spec.ts
Normal file
40
apps/gateway/src/auth/sso.controller.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { SsoController } from './sso.controller.js';
|
||||
|
||||
describe('SsoController', () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it('lists configured OIDC providers', () => {
|
||||
vi.stubEnv('WORKOS_CLIENT_ID', 'workos-client');
|
||||
vi.stubEnv('WORKOS_CLIENT_SECRET', 'workos-secret');
|
||||
vi.stubEnv('WORKOS_ISSUER', 'https://auth.workos.com/sso/client_123');
|
||||
|
||||
const controller = new SsoController();
|
||||
const providers = controller.list();
|
||||
|
||||
expect(providers.find((provider) => provider.id === 'workos')).toMatchObject({
|
||||
configured: true,
|
||||
loginMode: 'oidc',
|
||||
callbackPath: '/api/auth/oauth2/callback/workos',
|
||||
teamSync: { enabled: true, claim: 'organization_id' },
|
||||
});
|
||||
});
|
||||
|
||||
it('prefers SAML fallback for Keycloak when only the SAML login URL is configured', () => {
|
||||
vi.stubEnv('KEYCLOAK_SAML_LOGIN_URL', 'https://sso.example.com/realms/mosaic/protocol/saml');
|
||||
|
||||
const controller = new SsoController();
|
||||
const providers = controller.list();
|
||||
|
||||
expect(providers.find((provider) => provider.id === 'keycloak')).toMatchObject({
|
||||
configured: true,
|
||||
loginMode: 'saml',
|
||||
samlFallback: {
|
||||
configured: true,
|
||||
loginUrl: 'https://sso.example.com/realms/mosaic/protocol/saml',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user