Fixes to Intel SSO

Ylian Saint-Hilaire committed May 21, 2020 at 01:29 UTC a0b6d235ecbec9463cc7df7e2c0f18430bd97c36
1 file changed +6 -2
webserver.js
+6 -2
@@ -4266,9 +4266,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4266 passport.use(new SamlStrategy(options,
4267 function (profile, done) {
4268 if (typeof profile.nameID != 'string') { return done(); }
4269 - var user = { id: 'user/' + domain.id + '/~' + profile.issuer + ':' + profile.nameID, name: profile.nameID };
4269 + var user = { id: 'user/' + domain.id + '/~intel:' + profile.nameID, name: profile.nameID };
4270 if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
4271 + else if ((typeof profile.FirstName == 'string') && (typeof profile.LastName == 'string')) { user.name = profile.FirstName + ' ' + profile.LastName; }
4272 if (typeof profile.email == 'string') { user.email = profile.email; }
4273 + else if (typeof profile.EmailAddress == 'string') { user.email = profile.EmailAddress; }
4274 + console.log(user);
4275 return done(null, user);
4276 }
4277 ));
@@ -4276,6 +4279,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4279 domain.passport.authenticate('saml', { failureRedirect: '/', failureFlash: true })(req, res, next);
4280 });
4281 obj.app.post(url + 'auth-intel-callback', function (req, res, next) {
4282 + console.log('auth-intel-callback');
4283 domain.passport.authenticate('saml', { failureRedirect: '/', failureFlash: true })(req, res, next);
4284 }, handleStrategyLogin);
4285 }
@@ -4298,7 +4302,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4302 passport.use(new SamlStrategy(options,
4303 function (profile, done) {
4304 if (typeof profile.nameID != 'string') { return done(); }
4301 - var user = { id: 'user/' + domain.id + '/~' + profile.issuer + ':' + profile.nameID, name: profile.nameID };
4305 + var user = { id: 'user/' + domain.id + '/~jumpcloud:' + profile.nameID, name: profile.nameID };
4306 if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
4307 if (typeof profile.email == 'string') { user.email = profile.email; }
4308 return done(null, user);