mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
useTemplates for initsso as well
This commit is contained in:
parent
44e806cf1f
commit
8c7c9c166b
|
@ -106,9 +106,16 @@ export class ControllerRegistry {
|
||||||
try {
|
try {
|
||||||
return await controller[handlerName](...args);
|
return await controller[handlerName](...args);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (route.usesTemplates && error instanceof ResponseError) {
|
if (route.usesTemplates) {
|
||||||
res.writeHead(error.httpStatusCode, { 'Content-Type': 'text/plain' });
|
if (error instanceof ResponseError) {
|
||||||
return res.end(error.message);
|
return res
|
||||||
|
.writeHead(error.httpStatusCode, { 'Content-Type': 'text/plain' })
|
||||||
|
.send(error.message);
|
||||||
|
} else {
|
||||||
|
return res
|
||||||
|
.writeHead(500, { 'Content-Type': 'text/plain' })
|
||||||
|
.send('Internal Server Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,9 @@ export class SamlController {
|
||||||
throw new AuthError('SAML Authentication failed');
|
throw new AuthError('SAML Authentication failed');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isConnectionTestRequest) {
|
if (isConnectionTestRequest) {
|
||||||
return res.render('sso/saml-connection-test-failed', { message: (error as Error).message });
|
return res.render('sso/saml-connection-test-failed', {
|
||||||
|
message: (error as Error).message,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.eventService.emit('user-login-failed', {
|
this.eventService.emit('user-login-failed', {
|
||||||
userEmail: 'unknown',
|
userEmail: 'unknown',
|
||||||
|
@ -165,7 +167,11 @@ export class SamlController {
|
||||||
* Access URL for implementing SP-init SSO
|
* Access URL for implementing SP-init SSO
|
||||||
* This endpoint is available if SAML is licensed and enabled
|
* This endpoint is available if SAML is licensed and enabled
|
||||||
*/
|
*/
|
||||||
@Get('/initsso', { middlewares: [samlLicensedAndEnabledMiddleware], skipAuth: true })
|
@Get('/initsso', {
|
||||||
|
middlewares: [samlLicensedAndEnabledMiddleware],
|
||||||
|
skipAuth: true,
|
||||||
|
usesTemplates: true,
|
||||||
|
})
|
||||||
async initSsoGet(req: express.Request, res: express.Response) {
|
async initSsoGet(req: express.Request, res: express.Response) {
|
||||||
let redirectUrl = '';
|
let redirectUrl = '';
|
||||||
try {
|
try {
|
||||||
|
@ -189,7 +195,7 @@ export class SamlController {
|
||||||
* Test SAML config
|
* Test SAML config
|
||||||
* This endpoint is available if SAML is licensed and the requestor is an instance owner
|
* This endpoint is available if SAML is licensed and the requestor is an instance owner
|
||||||
*/
|
*/
|
||||||
@Get('/config/test', { middlewares: [samlLicensedMiddleware] })
|
@Get('/config/test', { middlewares: [samlLicensedMiddleware], usesTemplates: true })
|
||||||
@GlobalScope('saml:manage')
|
@GlobalScope('saml:manage')
|
||||||
async configTestGet(_: AuthenticatedRequest, res: express.Response) {
|
async configTestGet(_: AuthenticatedRequest, res: express.Response) {
|
||||||
return await this.handleInitSSO(res, getServiceProviderConfigTestReturnUrl());
|
return await this.handleInitSSO(res, getServiceProviderConfigTestReturnUrl());
|
||||||
|
|
Loading…
Reference in a new issue