mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
delete unnecessary code
This commit is contained in:
parent
39e6432b05
commit
44e806cf1f
|
@ -15,7 +15,7 @@ import {
|
|||
samlLicensedAndEnabledMiddleware,
|
||||
samlLicensedMiddleware,
|
||||
} from '../middleware/saml-enabled-middleware';
|
||||
import { isConnectionTestRequest, isSamlLicensedAndEnabled } from '../saml-helpers';
|
||||
import { isSamlLicensedAndEnabled } from '../saml-helpers';
|
||||
import { SamlService } from '../saml.service.ee';
|
||||
import {
|
||||
getServiceProviderConfigTestReturnUrl,
|
||||
|
@ -111,10 +111,11 @@ export class SamlController {
|
|||
res: express.Response,
|
||||
binding: SamlLoginBinding,
|
||||
) {
|
||||
const isConnectionTestRequest = req.body.RelayState === getServiceProviderConfigTestReturnUrl();
|
||||
try {
|
||||
const loginResult = await this.samlService.handleSamlLogin(req, binding);
|
||||
// if RelayState is set to the test connection Url, this is a test connection
|
||||
if (isConnectionTestRequest(req)) {
|
||||
if (isConnectionTestRequest) {
|
||||
if (loginResult.authenticatedUser) {
|
||||
return res.render('sso/saml-connection-test-success', loginResult.attributes);
|
||||
} else {
|
||||
|
@ -149,7 +150,7 @@ export class SamlController {
|
|||
});
|
||||
throw new AuthError('SAML Authentication failed');
|
||||
} catch (error) {
|
||||
if (isConnectionTestRequest(req)) {
|
||||
if (isConnectionTestRequest) {
|
||||
return res.render('sso/saml-connection-test-failed', { message: (error as Error).message });
|
||||
}
|
||||
this.eventService.emit('user-login-failed', {
|
||||
|
|
|
@ -13,8 +13,6 @@ import { License } from '@/license';
|
|||
import { PasswordUtility } from '@/services/password.utility';
|
||||
|
||||
import { SAML_LOGIN_ENABLED, SAML_LOGIN_LABEL } from './constants';
|
||||
import { getServiceProviderConfigTestReturnUrl } from './service-provider.ee';
|
||||
import type { SamlConfiguration } from './types/requests';
|
||||
import type { SamlAttributeMapping } from './types/saml-attribute-mapping';
|
||||
import type { SamlPreferences } from './types/saml-preferences';
|
||||
import type { SamlUserAttributes } from './types/saml-user-attributes';
|
||||
|
@ -164,7 +162,3 @@ export function getMappedSamlAttributesFromFlowResult(
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function isConnectionTestRequest(req: SamlConfiguration.AcsRequest): boolean {
|
||||
return req.body.RelayState === getServiceProviderConfigTestReturnUrl();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue