|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
const _ = require('lodash')
|
|
|
|
/* global WIKI */
|
|
|
|
/* global WIKI */
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// ------------------------------------
|
|
|
@ -10,15 +11,24 @@ module.exports = {
|
|
|
|
init (passport, conf) {
|
|
|
|
init (passport, conf) {
|
|
|
|
passport.use(conf.key,
|
|
|
|
passport.use(conf.key,
|
|
|
|
new CASStrategy({
|
|
|
|
new CASStrategy({
|
|
|
|
ssoBaseURL: conf.ssoBaseURL,
|
|
|
|
version: conf.casVersion,
|
|
|
|
serverBaseURL: conf.serverBaseURL,
|
|
|
|
ssoBaseURL: conf.casUrl,
|
|
|
|
|
|
|
|
serverBaseURL: conf.baseUrl,
|
|
|
|
|
|
|
|
serviceURL: conf.callbackURL,
|
|
|
|
passReqToCallback: true
|
|
|
|
passReqToCallback: true
|
|
|
|
}, async (req, profile, cb) => {
|
|
|
|
}, async (req, profile, cb) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const user = await WIKI.models.users.processProfile({
|
|
|
|
const user = await WIKI.models.users.processProfile({
|
|
|
|
providerKey: req.params.strategy,
|
|
|
|
providerKey: req.params.strategy,
|
|
|
|
profile
|
|
|
|
profile: {
|
|
|
|
|
|
|
|
...profile,
|
|
|
|
|
|
|
|
id: _.get(profile.attributes, conf.uniqueIdAttribute, profile.user),
|
|
|
|
|
|
|
|
email: _.get(profile.attributes, conf.emailAttribute),
|
|
|
|
|
|
|
|
name: _.get(profile.attributes, conf.displayNameAttribute, profile.user),
|
|
|
|
|
|
|
|
picture: ''
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
cb(null, user)
|
|
|
|
cb(null, user)
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
cb(err, null)
|
|
|
|
cb(err, null)
|
|
|
|