|
|
@@ -2,7 +2,8 @@ const debug = require('debug')('growi:service:PassportService');
|
|
|
const passport = require('passport');
|
|
|
const LocalStrategy = require('passport-local').Strategy;
|
|
|
const LdapStrategy = require('passport-ldapauth');
|
|
|
-const GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
|
|
|
+// const GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
|
|
|
+const GoogleStrategy = require('passport-google-oauth20').Strategy;
|
|
|
|
|
|
/**
|
|
|
* the service class of Passport
|
|
|
@@ -264,31 +265,20 @@ class PassportService {
|
|
|
|
|
|
debug('GoogleStrategy: setting up..');
|
|
|
|
|
|
- // passport.use(new LdapStrategy(this.getLdapConfigurationFunc(config, {passReqToCallback: true}),
|
|
|
- // (req, ldapAccountInfo, done) => {
|
|
|
- // debug('LDAP authentication has succeeded', ldapAccountInfo);
|
|
|
-
|
|
|
- // // store ldapAccountInfo to req
|
|
|
- // req.ldapAccountInfo = ldapAccountInfo;
|
|
|
-
|
|
|
- // done(null, ldapAccountInfo);
|
|
|
- // }
|
|
|
- // ));
|
|
|
- console.log(config.crowi['security:passport-google:clientId'])
|
|
|
- console.log(config.crowi['security:passport-google:clientSecret'])
|
|
|
-
|
|
|
passport.use(new GoogleStrategy({
|
|
|
clientID: config.crowi['security:passport-google:clientId'],
|
|
|
clientSecret: config.crowi['security:passport-google:clientSecret'],
|
|
|
- callbackURL: '/auth/passport/google/callback',
|
|
|
- },
|
|
|
- function(accessToken, refreshToken, profile, done) {
|
|
|
- console.log(profile)
|
|
|
- // User.findOrCreate({ googleId: profile.id }, function(err, user) {
|
|
|
- // return done(err, user);
|
|
|
- // });
|
|
|
- }
|
|
|
- ));
|
|
|
+ callbackURL: '/passport/google/callback',
|
|
|
+ }, function(accessToken, refreshToken, profile, done) {
|
|
|
+ // Do something here
|
|
|
+ console.log(profile);
|
|
|
+ if (profile) {
|
|
|
+ return done(null, profile);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return done(null, false);
|
|
|
+ }
|
|
|
+ }));
|
|
|
|
|
|
this.isGoogleStrategySetup = true;
|
|
|
debug('GoogleStrategy: setup is done');
|