authentication.js 577 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* global WIKI */

// ------------------------------------
// CAS Account
// ------------------------------------

const CASStrategy = require('passport-cas').Strategy

module.exports = {
  init (passport, conf) {
    passport.use('cas',
      new CASStrategy({
        ssoBaseURL: conf.ssoBaseURL,
        serverBaseURL: conf.serverBaseURL
      }, (profile, cb) => {
16
        WIKI.models.users.processProfile(profile).then((user) => {
17 18 19 20 21 22 23 24
          return cb(null, user) || true
        }).catch((err) => {
          return cb(err, null) || true
        })
      }
      ))
  }
}