2
0

authentication.js 863 B

123456789101112131415161718192021222324252627282930
  1. /* global WIKI */
  2. // ------------------------------------
  3. // Azure AD Account
  4. // ------------------------------------
  5. const OIDCStrategy = require('passport-azure-ad').OIDCStrategy
  6. module.exports = {
  7. init (passport, conf) {
  8. passport.use('azure',
  9. new OIDCStrategy({
  10. identityMetadata: conf.entryPoint,
  11. clientID: conf.clientId,
  12. redirectUrl: conf.callbackURL,
  13. responseType: 'id_token',
  14. responseMode: 'form_post',
  15. scope: ['profile', 'email', 'openid'],
  16. allowHttpForRedirectUrl: WIKI.IS_DEBUG
  17. }, (iss, sub, profile, cb) => {
  18. console.info(iss, sub, profile)
  19. // WIKI.models.users.processProfile(waadProfile).then((user) => {
  20. // return cb(null, user) || true
  21. // }).catch((err) => {
  22. // return cb(err, null) || true
  23. // })
  24. }
  25. ))
  26. }
  27. }