Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
github: {
name: 'GitHub',
protocol: 'oauth2',
strategy: require('passport-github').Strategy
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
var self = this
, strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var options = { passReqToCallback: true }, Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
Strategy = strategies[key].strategy;
self.use(new Strategy(options, self.protocols.local.login));
github: {
name: 'GitHub',
protocol: 'oauth2',
strategy: require('passport-github').Strategy
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
var self = this
, strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var options = { passReqToCallback: true }, Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
//Let users override the username and passwordField from the options
_.extend(options, strategies[key].options || {});
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
github: {
name: 'GitHub',
protocol: 'oauth2',
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
* @param {Object} request
*/
passport.loadStrategies = function(request) {
var self = this;
var strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var options = { passReqToCallback: true }, Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
Strategy = strategies[key].strategy;
self.use(new Strategy(options, self.protocols.local.login));
*
github: {
name: 'GitHub',
protocol: 'oauth2',
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
var strategies = sails.config.passport;
_.each(strategies, _.bind(function (strategy, key) {
var options = {
passReqToCallback: true
};
var Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, {
usernameField: 'identifier'
});
// Only load the local strategy if it's enabled in the config
github: {
name: 'GitHub',
protocol: 'oauth2',
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
* @param {Object} req
*/
passport.loadStrategies = function (req) {
var self = this
, strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var Strategy = require('passport-' + key).Strategy
, options = { passReqToCallback: true };
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
// Only load the local strategy if it's enabled in the config
if (strategies[key]) {
self.use(new Strategy(options, self.protocols.local.login));
}
github: {
name: 'GitHub',
protocol: 'oauth2',
strategy: require('passport-github').Strategy
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
var self = this
, strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var options = { passReqToCallback: true }, Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
//Let users override the username and passwordField from the options
_.extend(options, strategies[key].options || {});
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
github: {
name: 'GitHub',
protocol: 'oauth2',
strategy: require('passport-github').Strategy
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
var self = this
, strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
var options = { passReqToCallback: true }, Strategy;
if (key === 'local') {
// Since we need to allow users to login using both usernames as well as
// emails, we'll set the username field to something more generic.
_.extend(options, { usernameField: 'identifier' });
//Let users override the username and passwordField from the options
_.extend(options, strategies[key].options || {});
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
github: {
name: 'GitHub',
protocol: 'oauth2',
strategy: require('passport-github').Strategy
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
*/
passport.loadStrategies = function () {
const self = this,
strategies = sails.config.passport;
Object.keys(strategies).forEach(function (key) {
const options = { passReqToCallback: true };
let Strategy;
if (key === 'local') {
_.extend(options, { usernameField: 'name' });
_.extend(options, strategies[key].options || {});
// Only load the local strategy if it's enabled in the config
if (strategies.local) {
Strategy = strategies[key].strategy;
github: {
name: 'GitHub',
protocol: 'oauth2',
scope: [ 'user', 'gist' ]
options: {
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
}
}
*
* For more information on the providers supported by Passport.js, check out:
* http://passportjs.org/guide/providers/
*
* @param {Request} request
*/
passport.loadStrategies = function loadStrategies(request) {
sails.log.verbose(__filename + ':' + __line + ' [Service.Passport.loadStrategies() called]');
var self = this;
var strategies = sails.config.passport;
Object.keys(strategies).forEach(function(key) {
var options = {passReqToCallback: true};
var Strategy;
if (key === 'local') {
/**
* Since we need to allow users to login using both usernames as well as
* emails, we'll set the username field to something more generic.
*/
_.extend(options, {usernameField: 'identifier'});