Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
})
.catch(next);
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport;
var provider = req.param('provider');
var options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!_.has(strategies, provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (_.has(strategies[provider], 'scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,
}
}
});
}
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Request} request
* @param {Response} response
*/
passport.endpoint = function endpoint(request, response) {
sails.log.verbose(__filename + ':' + __line + ' [Service.Passport.endpoint() called]');
var strategies = sails.config.passport;
var provider = request.param('provider');
var options = {};
// If a provider doesn't exist for this endpoint, send the user back to the login page
if (!strategies.hasOwnProperty(provider)) {
response.json(401, 'Unknown auth provider');
} else {
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Load authentication strategies
}
}
});
}
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} request
* @param {Object} response
*/
passport.endpoint = function(request, response) {
var strategies = sails.config.passport;
var provider = request.param('provider');
var options = {};
// If a provider doesn't exist for this endpoint, send the user back to the login page
if (!strategies.hasOwnProperty(provider)) {
response.json(401, 'Unknown auth provider');
} else {
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Load authentication strategies
this.loadStrategies(request);
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport
, provider = req.param('provider')
, options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport
, provider = req.param('provider')
, options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport
, provider = req.param('provider')
, options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Load authentication strategies
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
const strategies = sails.config.passport,
provider = req.param('provider'),
options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport
, provider = req.param('provider')
, options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,
next(null, req.user);
}
}
});
};
/**
* Create an authentication endpoint
*
* For more information on authentication in Passport.js, check out:
* http://passportjs.org/guide/authenticate/
*
* @param {Object} req
* @param {Object} res
*/
passport.endpoint = function (req, res) {
var strategies = sails.config.passport
, provider = req.param('provider')
, options = {};
// If a provider doesn't exist for this endpoint, send the user back to the
// login page
if (!strategies.hasOwnProperty(provider)) {
return res.redirect('/login');
}
// Attach scope if it has been set in the config
if (strategies[provider].hasOwnProperty('scope')) {
options.scope = strategies[provider].scope;
}
// Redirect the user to the provider for authentication. When complete,