| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | 
							- const _ = require('lodash')
 
- // ------------------------------------
 
- // OpenID Connect Account
 
- // ------------------------------------
 
- const OpenIDConnectStrategy = require('passport-openidconnect').Strategy
 
- module.exports = {
 
-   init (passport, conf) {
 
-     passport.use(conf.key,
 
-       new OpenIDConnectStrategy({
 
-         authorizationURL: conf.authorizationURL,
 
-         tokenURL: conf.tokenURL,
 
-         clientID: conf.clientId,
 
-         clientSecret: conf.clientSecret,
 
-         issuer: conf.issuer,
 
-         userInfoURL: conf.userInfoURL,
 
-         callbackURL: conf.callbackURL,
 
-         passReqToCallback: true
 
-       }, async (req, iss, sub, profile, cb) => {
 
-         try {
 
-           const user = await WIKI.db.users.processProfile({
 
-             providerKey: req.params.strategy,
 
-             profile: {
 
-               ...profile,
 
-               email: _.get(profile, '_json.' + conf.emailClaim)
 
-             }
 
-           })
 
-           cb(null, user)
 
-         } catch (err) {
 
-           cb(err, null)
 
-         }
 
-       })
 
-     )
 
-   },
 
-   logout (conf) {
 
-     if (!conf.logoutURL) {
 
-       return '/'
 
-     } else {
 
-       return conf.logoutURL
 
-     }
 
-   }
 
- }
 
 
  |