mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
move sso-init-form to a handlebars view as well
This commit is contained in:
parent
85958e0967
commit
0e43286435
|
@ -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.');
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import type { PostBindingContext } from 'samlify/types/src/entity';
|
||||
|
||||
export function getInitSSOFormView(context: PostBindingContext): string {
|
||||
return `
|
||||
<form id="saml-form" method="post" action="${context.entityEndpoint}" autocomplete="off">
|
||||
<input type="hidden" name="${context.type}" value="${context.context}" />
|
||||
${context.relayState ? '<input type="hidden" name="RelayState" value="{{relayState}}" />' : ''}
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
// Automatic form submission
|
||||
(function(){
|
||||
document.forms[0].submit();
|
||||
})();
|
||||
</script>`;
|
||||
}
|
16
packages/cli/templates/sso/saml-init-form.handlebars
Normal file
16
packages/cli/templates/sso/saml-init-form.handlebars
Normal file
|
@ -0,0 +1,16 @@
|
|||
<html>
|
||||
<body>
|
||||
<form id="saml-form" method="post" action="{{entityEndpoint}}" autocomplete="off">
|
||||
<input type="hidden" name="{{type}}" value="{{context}}" />
|
||||
{{#if relayState}}
|
||||
<input type="hidden" name="RelayState" value="{{relayState}}" />
|
||||
{{/if}}
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
// Automatic form submission
|
||||
(function(){
|
||||
document.forms[0].submit();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue