mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
useTemplates for initsso as well
This commit is contained in:
parent
44e806cf1f
commit
8c7c9c166b
|
@ -106,9 +106,16 @@ export class ControllerRegistry {
|
|||
try {
|
||||
return await controller[handlerName](...args);
|
||||
} catch (error) {
|
||||
if (route.usesTemplates && error instanceof ResponseError) {
|
||||
res.writeHead(error.httpStatusCode, { 'Content-Type': 'text/plain' });
|
||||
return res.end(error.message);
|
||||
if (route.usesTemplates) {
|
||||
if (error instanceof ResponseError) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,9 @@ export class SamlController {
|
|||
throw new AuthError('SAML Authentication failed');
|
||||
} catch (error) {
|
||||
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', {
|
||||
userEmail: 'unknown',
|
||||
|
@ -165,7 +167,11 @@ export class SamlController {
|
|||
* Access URL for implementing SP-init SSO
|
||||
* 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) {
|
||||
let redirectUrl = '';
|
||||
try {
|
||||
|
@ -189,7 +195,7 @@ export class SamlController {
|
|||
* Test SAML config
|
||||
* 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')
|
||||
async configTestGet(_: AuthenticatedRequest, res: express.Response) {
|
||||
return await this.handleInitSSO(res, getServiceProviderConfigTestReturnUrl());
|
||||
|
|
Loading…
Reference in a new issue