Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* })
* @param agent PolicyAgent
*/
function OpenAMStrategy(agent) {
Strategy.call(this);
this.name = 'openam';
this.agent = agent;
if(!(agent instanceof PolicyAgent)) {
throw new Error('missing PolicyAgent')
}
}
util.inherits(OpenAMStrategy, Strategy);
Strategy.prototype.authenticate = function (req, options) {
options = options || {};
if (!options.noRedirect)
options.failureRedirect = this.agent.getLoginUrl(req);
var self = this, info;
if (self.agent.isNotEnforced(req))
return self.success(null, null);
this.agent.serverInfo
.then(function (serverInfo) {
var cookies = cookie.parse(req.headers.cookie || ''),
sessionId = cookies[serverInfo.cookieName];
return self.agent.validateSession(sessionId);
})
.then(function (res) {