Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parseLogoutRequest = function(req, res, next) {
if (!req.idp.options.sloUrl) {
return res.render('error', {
message: 'SAML Single Logout Service URL not defined for Service Provider'
});
};
console.log('Processing SAML SLO request for participant => \n', req.participant);
return samlp.logout({
issuer: req.idp.options.issuer,
cert: req.idp.options.cert,
key: req.idp.options.key,
digestAlgorithm: req.idp.options.digestAlgorithm,
signatureAlgorithm: req.idp.options.signatureAlgorithm,
sessionParticipants: new SessionParticipants(
[
req.participant
]),
clearIdPSession: function(callback) {
console.log('Destroying session ' + req.session.id + ' for participant', req.participant);
req.session.destroy();
callback();
}
})(req, res, next);
}
app.post('/logout', (req: any, res: any, next: any): void => {
samlp.logout({
issuer: Config.saml_issuer,
protocolBinding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
cert: cert,
key: key
})(req, res, next);
});