How to use the passport-strategy.prototype function in passport-strategy

To help you get started, we’ve selected a few passport-strategy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ForgeRock / node-openam-agent / lib / strategy.js View on Github external
*     })
 * @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) {

passport-strategy

An abstract class implementing Passport's strategy API.

MIT
Latest version published 11 years ago

Package Health Score

67 / 100
Full package analysis