feat: social login providers with dynamic instances
This commit is contained in:
@@ -12,28 +12,29 @@ module.exports = {
|
||||
init (passport, conf) {
|
||||
passport.use('keycloak',
|
||||
new KeycloakStrategy({
|
||||
authorizationURL: conf.authorizationURL,
|
||||
userInfoURL: conf.userInfoURL,
|
||||
authorizationURL: conf.authorizationURL,
|
||||
userInfoURL: conf.userInfoURL,
|
||||
tokenURL: conf.tokenURL,
|
||||
host: conf.host,
|
||||
host: conf.host,
|
||||
realm: conf.realm,
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, async (accessToken, refreshToken, profile, cb) => {
|
||||
callbackURL: conf.callbackURL,
|
||||
passReqToCallback: true
|
||||
}, async (req, accessToken, refreshToken, profile, cb) => {
|
||||
let displayName = profile.username
|
||||
if (_.isString(profile.fullName) && profile.fullName.length > 0) {
|
||||
displayName = profile.fullName
|
||||
}
|
||||
try {
|
||||
const user = await WIKI.models.users.processProfile({
|
||||
providerKey: req.params.strategy,
|
||||
profile: {
|
||||
id: profile.keycloakId,
|
||||
email: profile.email,
|
||||
name: displayName,
|
||||
picture: ''
|
||||
},
|
||||
providerKey: 'keycloak'
|
||||
}
|
||||
})
|
||||
cb(null, user)
|
||||
} catch (err) {
|
||||
|
Reference in New Issue
Block a user