From 0e43286435b21a783cba1ef191db0a7849b0a26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 22 Oct 2024 13:32:47 +0200 Subject: [PATCH] move sso-init-form to a handlebars view as well --- .../src/sso/saml/routes/saml.controller.ee.ts | 3 +-- packages/cli/src/sso/saml/views/init-sso-post.ts | 15 --------------- .../cli/templates/sso/saml-init-form.handlebars | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 packages/cli/src/sso/saml/views/init-sso-post.ts create mode 100644 packages/cli/templates/sso/saml-init-form.handlebars diff --git a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts index e7c73200b6..d51adec3a2 100644 --- a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts +++ b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts @@ -26,7 +26,6 @@ import { } from '../service-provider.ee'; import type { SamlLoginBinding } from '../types'; import { SamlConfiguration } from '../types/requests'; -import { getInitSSOFormView } from '../views/init-sso-post'; @RestController('/sso/saml') export class SamlController { @@ -207,7 +206,7 @@ export class SamlController { if (result?.binding === 'redirect') { return result.context.context; } else if (result?.binding === 'post') { - return res.send(getInitSSOFormView(result.context as PostBindingContext)); + return res.render('sso/saml-init-form', result.context); } else { throw new AuthError('SAML redirect failed, please check your SAML configuration.'); } diff --git a/packages/cli/src/sso/saml/views/init-sso-post.ts b/packages/cli/src/sso/saml/views/init-sso-post.ts deleted file mode 100644 index 4df6719efb..0000000000 --- a/packages/cli/src/sso/saml/views/init-sso-post.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { PostBindingContext } from 'samlify/types/src/entity'; - -export function getInitSSOFormView(context: PostBindingContext): string { - return ` -
- - ${context.relayState ? '' : ''} -
-`; -} diff --git a/packages/cli/templates/sso/saml-init-form.handlebars b/packages/cli/templates/sso/saml-init-form.handlebars new file mode 100644 index 0000000000..af6bc23ba8 --- /dev/null +++ b/packages/cli/templates/sso/saml-init-form.handlebars @@ -0,0 +1,16 @@ + + +
+ + {{#if relayState}} + + {{/if}} +
+ + +