feat(core): Limit user changes when saml is enabled (#5577)

* consolidate SSO settings

* update saml settings

* fix type error

* limit user changes when saml is enabled

* add test
This commit is contained in:
Michael Auerswald
2023-03-03 10:05:30 +01:00
committed by GitHub
parent a91b631411
commit b5179597f3
5 changed files with 116 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
import type { RequestHandler } from 'express';
import type { AuthenticatedRequest } from '../../../requests';
import { isSamlCurrentAuthenticationMethod } from '../../ssoHelpers';
import { isSamlLoginEnabled, isSamlLicensed } from '../samlHelpers';
import { isSamlLicensed, isSamlLicensedAndEnabled } from '../samlHelpers';
export const samlLicensedOwnerMiddleware: RequestHandler = (
req: AuthenticatedRequest,
@@ -16,7 +15,7 @@ export const samlLicensedOwnerMiddleware: RequestHandler = (
};
export const samlLicensedAndEnabledMiddleware: RequestHandler = (req, res, next) => {
if (isSamlLoginEnabled() && isSamlLicensed() && isSamlCurrentAuthenticationMethod()) {
if (isSamlLicensedAndEnabled()) {
next();
} else {
res.status(401).json({ status: 'error', message: 'Unauthorized' });