passport‐azure‐ad - GluuFederation/tutorials GitHub Wiki
Overview
Currently, gluu-passport is not supporting passport-azure-ad. You need to manually install, configure it and add little code patch in it.
- Install passport-azure-ad. Run below command inside chroot
# service passport stop
# cd /opt/gluu/node/passport
# npm i
# npm i passport-azure-ad
- Add mapping file
# cd /opt/gluu/node/passport
# touch server/mappings/azure-ad.js
add the below content in the azure-ad.js file.
module.exports = profile => {
return {
uid: profile.username || profile.oid,
mail: profile.emails && profile.emails[0] && profile.emails[0].value,
cn: profile.displayName,
displayName: profile.displayName,
givenName: profile.name.givenName,
sn: profile.name.familyName
}
}
- Add JS Code in
provider.jsat line no. 71 to add support forpassport-azure-adstrategy
// Before
if (provider.type === 'oauth' && Strategy.OAuth2Strategy) {
Strategy = Strategy.OAuth2Strategy
} else {
Strategy = Strategy.Strategy
}
// After
if (provider.type === 'oauth' && Strategy.OAuth2Strategy) {
Strategy = Strategy.OAuth2Strategy
} else if (provider.type === 'oauth' && Strategy.OIDCStrategy) {
Strategy = Strategy.OIDCStrategy
} else {
Strategy = Strategy.Strategy
}
- Add provider
More settings and configurations
-
Restart passport
service passport restartand check service statusservice passport status -
Check passport.log for any error