n8n
Version:
n8n Workflow Automation Tool
46 lines • 2.33 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServiceProviderInstance = exports.getServiceProviderConfigTestReturnUrl = exports.getServiceProviderReturnUrl = exports.getServiceProviderEntityId = void 0;
const typedi_1 = require("typedi");
const url_service_1 = require("../../services/url.service");
let serviceProviderInstance;
function getServiceProviderEntityId() {
return typedi_1.Container.get(url_service_1.UrlService).getInstanceBaseUrl() + '/rest/sso/saml/metadata';
}
exports.getServiceProviderEntityId = getServiceProviderEntityId;
function getServiceProviderReturnUrl() {
return typedi_1.Container.get(url_service_1.UrlService).getInstanceBaseUrl() + '/rest/sso/saml/acs';
}
exports.getServiceProviderReturnUrl = getServiceProviderReturnUrl;
function getServiceProviderConfigTestReturnUrl() {
return typedi_1.Container.get(url_service_1.UrlService).getInstanceBaseUrl() + '/config/test/return';
}
exports.getServiceProviderConfigTestReturnUrl = getServiceProviderConfigTestReturnUrl;
function getServiceProviderInstance(prefs, samlify) {
if (serviceProviderInstance === undefined) {
serviceProviderInstance = samlify.ServiceProvider({
entityID: getServiceProviderEntityId(),
authnRequestsSigned: prefs.authnRequestsSigned,
wantAssertionsSigned: prefs.wantAssertionsSigned,
wantMessageSigned: prefs.wantMessageSigned,
signatureConfig: prefs.signatureConfig,
relayState: prefs.relayState,
nameIDFormat: ['urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'],
assertionConsumerService: [
{
isDefault: prefs.acsBinding === 'post',
Binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
Location: getServiceProviderReturnUrl(),
},
{
isDefault: prefs.acsBinding === 'redirect',
Binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-REDIRECT',
Location: getServiceProviderReturnUrl(),
},
],
});
}
return serviceProviderInstance;
}
exports.getServiceProviderInstance = getServiceProviderInstance;
//# sourceMappingURL=serviceProvider.ee.js.map
;