Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
requestIdExpirationPeriodMs: 3600000,
cacheProvider: {}, // since we won't be sticking around ...
forceAuthn: true,
identifierFormat: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
decryptionPvk: fs.readFileSync("saml_sp.key").toString()
};
saml_options.callbackUrl =
'https://' + event['api-id'] + '.execute-api.' + event.region + '.amazonaws.com/' +
event.stage + event['resource-path'];
console.log('callbackURL is ' + saml_options.callbackUrl);
var certificate = fs.readFileSync("saml_sp.crt").toString();
var saml = new SAML(saml_options);
var metadata = saml.generateServiceProviderMetadata(certificate);
console.log("Created metadata: %j", metadata);
context.done(null, metadata);
};
}, function AssertResponse(next) {
var saml = new SAML(saml_options);
console.log("Going to try and assert a response: %j", saml_options);
var saml2_response = xpath.select(SAML2_RESPONSE_XPATH, saml_doc).toString();
console.log('using saml2_response: %j', saml2_response);
console.log("Retrieving real name from XML");
realName = xpath.select(REALNAME_XPATH, saml_doc).toString();
console.log("Got realName of " + realName);
var encoded_response = new Buffer(saml2_response).toString('base64');
var response = {
SAMLResponse: encoded_response
};
saml.validatePostResponse(response, next);
},
function checkLoggedOut(profile, loggedOut, next) {
function createLoginRequest(next) {
var saml = new SAML(saml_options);
var saml_request = { callbackUrl: callback, };
saml.generateAuthorizeRequest(saml_request, is_passive, next);
},
function receiveCreatedLoginRequest(req, next) {