feat(core): Improve ldap/saml toggle and tests (#5771)

* improve ldap/saml toggle and tests

* import cleanup

* reject regular login users when saml is enabled

* lint fix
This commit is contained in:
Michael Auerswald
2023-03-24 17:46:06 +01:00
committed by GitHub
parent 30aeeb70b4
commit 47ee357059
9 changed files with 186 additions and 43 deletions

View File

@@ -78,6 +78,9 @@ import { LdapManager } from '@/Ldap/LdapManager.ee';
import { LDAP_ENABLED } from '@/Ldap/constants';
import { handleLdapInit } from '@/Ldap/helpers';
import { Push } from '@/push';
import { setSamlLoginEnabled } from '@/sso/saml/samlHelpers';
import { SamlService } from '@/sso/saml/saml.service.ee';
import { SamlController } from '@/sso/saml/routes/saml.controller.ee';
export const mockInstance = <T>(
ctor: new (...args: any[]) => T,
@@ -190,6 +193,11 @@ export async function initTestServer({
new LdapController(service, sync, internalHooks),
);
break;
case 'saml':
await setSamlLoginEnabled(true);
const samlService = Container.get(SamlService);
registerController(testServer.app, config, new SamlController(samlService));
break;
case 'nodes':
registerController(
testServer.app,