feat: azure ad auth

This commit is contained in:
Nick 2019-07-20 11:09:55 -04:00
parent 9966a97bd3
commit 0c6472ab85

View File

@ -1,3 +1,5 @@
const _ = require('lodash')
/* global WIKI */ /* global WIKI */
// ------------------------------------ // ------------------------------------
@ -17,14 +19,22 @@ module.exports = {
responseMode: 'form_post', responseMode: 'form_post',
scope: ['profile', 'email', 'openid'], scope: ['profile', 'email', 'openid'],
allowHttpForRedirectUrl: WIKI.IS_DEBUG allowHttpForRedirectUrl: WIKI.IS_DEBUG
}, (iss, sub, profile, cb) => { }, async (iss, sub, profile, cb) => {
console.info(iss, sub, profile) try {
// WIKI.models.users.processProfile(waadProfile).then((user) => { const user = await WIKI.models.users.processProfile({
// return cb(null, user) || true profile: {
// }).catch((err) => { id: profile.oid,
// return cb(err, null) || true displayName: profile.displayName,
// }) email: _.get(profile, '_json.email', ''),
} picture: ''
)) },
providerKey: 'azure'
})
cb(null, user)
} catch (err) {
cb(err, null)
}
})
)
} }
} }