fix bug with required group + debug cleanup
mstrhakr committed
Sep 6, 2022 at 17:58 UTC
25345fe6b533d0a7177634cec8f03ea66a25c567
1 file changed
+47
-42
webserver.js
+47
-42
@@ -655,7 +655,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
655
user.siteadmin = 0xFFFFFFFF;
656
userChanged = true;
657
} else if ((siteAdminGroup === false) && (user.siteadmin === 0xFFFFFFFF)) {
658
- parent.debug('authlog', `LDAP: Remoking site admin privilages to user "${user.name}" since they are not found in any administrator groups.`);
658
+ parent.debug('authlog', `LDAP: Revoking site admin privilages from user "${user.name}" since they are not found in any administrator groups.`);
659
delete user.siteadmin;
660
userChanged = true;
661
}
@@ -2521,7 +2521,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2521
const domain = checkUserIpAddress(req, res);
2522
const authStrategy = req.user.strategy
2523
if (domain == null) { return; }
2524
- parent.debug('authlog', `${authStrategy} - Login: ` + JSON.stringify(req.user));
2524
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Verified user: ${JSON.stringify(req.user, null, 4)}` + JSON.stringify(req.user));
2525
if ((req.user != null) && (req.user.sid != null)) {
2526
2527
// Check if any group related options exist
@@ -2530,7 +2530,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2530
if (typeof domain.authstrategies[authStrategy].groups === 'object') {
2531
if (Array.isArray(req.user.groups)) { userMemberships = req.user.groups; }
2532
else if (typeof req.user.groups == 'string') { userMemberships = [req.user.groups]; }
2533
- parent.debug('authlog', `${authStrategy}: User login with reported memberships from IdP: ${userMemberships.join(', ')}`);
2533
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Member Of: ${userMemberships.join(', ')}`);
2534
2535
// See if the user is required to be part of a specific group in order to log into this server.
2536
if (typeof domain.authstrategies[authStrategy].groups.required == 'string') { domain.authstrategies[authStrategy].groups.required = [domain.authstrategies[authStrategy].groups.required]; }
@@ -2539,10 +2539,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2539
for (var i in domain.authstrategies[authStrategy].groups.required) {
2540
if (userMemberships.indexOf(domain.authstrategies[authStrategy].groups.required[i]) >= 0) {
2541
userMembershipMatch = true;
2542
- parent.debug('authlog', `${authStrategy}: Login user found in required group: ${domain.authstrategies[authStrategy].groups.required[i]}`);
2542
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: ${req.user.name} is member of required group: ${domain.authstrategies[authStrategy].groups.required[i]}`);
2543
}
2544
}
2545
- if (userMembershipMatch === false) { parent.debug('authlog', `${authStrategy}: User login denied. User not found in required group.`); fn('denied'); return;}
2545
+ if (userMembershipMatch === false) {
2546
+ parent.debug('authlog', `${authStrategy}: User login denied. User not found in required group.`);
2547
+ req.session.loginmode = 1;
2548
+ req.session.messageid = 100; // Unable to create account.
2549
+ res.redirect(domain.url + getQueryPortion(req));
2550
+ return;
2551
+ }
2552
}
2553
2554
// Check if user is in an administrator group
@@ -2556,20 +2562,18 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2562
2563
// See if we need to sync user-memberships (IdP) with user-groups (meshcentral)
2564
if (domain.authstrategies[authStrategy].groups.sync === true) { domain.authstrategies[authStrategy].groups.sync = { enabled: true }; }
2559
- if ((typeof domain.authstrategies[authStrategy].groups.sync == 'object') && (domain.authstrategies[authStrategy].groups.sync.enabled == true)) {
2565
+ if (typeof domain.authstrategies[authStrategy].groups.sync.filter == 'string' || Array.isArray(domain.authstrategies[authStrategy].groups.sync.filter)) {
2566
if (typeof domain.authstrategies[authStrategy].groups.sync.filter == 'string') { domain.authstrategies[authStrategy].groups.sync.filter = [ domain.authstrategies[authStrategy].groups.sync.filter ]; }
2567
const filteredMemberships = [];
2562
- if (Array.isArray(domain.authstrategies[authStrategy].groups.sync.filter)) {
2563
- for (var i in userMemberships) {
2564
- for (var j in domain.authstrategies[authStrategy].groups.sync.filter) {
2565
- if (userMemberships[i].indexOf(domain.authstrategies[authStrategy].groups.sync.filter[j]) >= 0) { filteredMemberships.push(userMemberships[i]); }
2566
- }
2568
+ for (var i in userMemberships) {
2569
+ for (var j in domain.authstrategies[authStrategy].groups.sync.filter) {
2570
+ if (userMemberships[i].indexOf(domain.authstrategies[authStrategy].groups.sync.filter[j]) >= 0) { filteredMemberships.push(userMemberships[i]); }
2571
}
2572
}
2573
if (filteredMemberships.length > 0) {
2570
- parent.debug('authlog', `${authStrategy}: Filtered user memberships from config: ${filteredMemberships.join(', ')}`);
2574
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Filtered user memberships from config: ${filteredMemberships.join(', ')}`);
2575
} else {
2572
- parent.debug('authlog', `${authStrategy}: No groups found with filter: ${domain.authstrategies[authStrategy].groups.sync.filter.join(', ')}`);
2576
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: No groups found with filter: ${domain.authstrategies[authStrategy].groups.sync.filter.join(', ')}`);
2577
}
2578
userMemberships = filteredMemberships;
2579
}
@@ -2592,7 +2596,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2596
2597
if (newAccountAllowed === true) {
2598
// Create the user
2595
- parent.debug('authlog', `${authStrategy}: Creating new login user: "${userid}"`);
2599
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Creating new login user: "${userid}"`);
2600
user = { type: 'user', _id: userid, name: req.user.name, email: req.user.email, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), access: Math.floor(Date.now() / 1000), domain: domain.id };
2601
if (req.user.email != null) { user.email = req.user.email; user.emailVerified = true; }
2602
if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; } // New accounts automatically assigned server rights.
@@ -2632,7 +2636,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2636
2637
// See if the user is a member of the site admin group.
2638
if (typeof siteAdminGroup === 'string') {
2635
- parent.debug('authlog', `${authStrategy}: Granting site admin privilages to new user "${user.name}" found in admin group: ${siteAdminGroup}`);
2639
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Granting site admin privilages to new user "${user.name}" found in admin group: ${siteAdminGroup}`);
2640
user.siteadmin = 0xFFFFFFFF;
2641
}
2642
}
@@ -2657,7 +2661,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2661
obj.parent.DispatchEvent(targets, obj, loginEvent);
2662
} else {
2663
// New users not allowed
2660
- parent.debug('authlog', `${authStrategy}: Can\'t create new user, account creation is not allowed`);
2664
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Can\'t create new user, account creation is not allowed`);
2665
req.session.loginmode = 1;
2666
req.session.messageid = 100; // Unable to create account.
2667
res.redirect(domain.url + getQueryPortion(req));
@@ -2675,11 +2679,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2679
// See if the user is a member of the site admin group.
2680
if ((typeof domain.authstrategies[authStrategy].groups.siteadmin !== 'undefined') && (domain.authstrategies[authStrategy].groups.siteadmin !== null)) {
2681
if ((typeof siteAdminGroup === 'string') && (user.siteadmin !== 0xFFFFFFFF)) {
2678
- parent.debug('authlog', `${authStrategy}: Granting site admin privilages to user "${user.name}" found in administrator group: ${siteAdminGroup}`);
2682
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Granting site admin privilages to user "${user.name}" found in administrator group: ${siteAdminGroup}`);
2683
user.siteadmin = 0xFFFFFFFF;
2684
userChanged = true;
2685
} else if ((siteAdminGroup === false) && (user.siteadmin === 0xFFFFFFFF)) {
2682
- parent.debug('authlog', `${authStrategy}: Remoking site admin privilages to user "${user.name}" since they are not found in any administrator groups.`);
2686
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: Revoking site admin privilages from user "${user.name}" since they are not found in any administrator groups.`);
2687
delete user.siteadmin;
2688
userChanged = true;
2689
}
@@ -2695,7 +2699,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2699
if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to create the user. Another event will come.
2700
parent.DispatchEvent(targets, obj, event);
2701
}
2698
- parent.debug('authlog', `${authStrategy}: succesful login: ${userid}`);
2702
req.session.userid = userid;
2703
setSessionRandom(req);
2704
@@ -2705,6 +2708,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2708
const ua = obj.getUserAgentInfo(req);
2709
const loginEvent = { etype: 'user', userid: user._id, username: user.name, account: obj.CloneSafeUser(user), action: 'login', msgid: 107, msgArgs: [req.clientIp, ua.browserStr, ua.osStr], msg: 'Account login', domain: domain.id, ip: req.clientIp, userAgent: req.headers['user-agent'], twoFactorType: 'sso' };
2710
obj.parent.DispatchEvent(targets, obj, loginEvent);
2711
+ parent.debug('authlog', `${authStrategy.toUpperCase()}: User Logged In: Name: ${user.name} ID: ${user._id}`);
2712
}
2713
} else { parent.debug('warn', 'handleStrategyLogin: FAILED - No user'); }
2714
//res.redirect(domain.url); // This does not handle cookie correctly.
@@ -6918,10 +6922,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6922
const TwitterStrategy = require('passport-twitter');
6923
var options = { consumerKey: domain.authstrategies.twitter.clientid, consumerSecret: domain.authstrategies.twitter.clientsecret };
6924
if (typeof domain.authstrategies.twitter.callbackurl == 'string') { options.callbackURL = domain.authstrategies.twitter.callbackurl; } else { options.callbackURL = url + 'auth-twitter-callback'; }
6921
- parent.debug('web', 'Adding Twitter SSO with options: ' + JSON.stringify(options));
6925
+ parent.debug('authlog', 'Adding Twitter SSO with options: ' + JSON.stringify(options));
6926
passport.use('twitter-' + domain.id, new TwitterStrategy(options,
6927
function (token, tokenSecret, profile, cb) {
6924
- parent.debug('web', 'Twitter profile: ' + JSON.stringify(profile));
6928
+ parent.debug('authlog', 'Twitter profile: ' + JSON.stringify(profile));
6929
var user = { sid: '~twitter:' + profile.id, name: profile.displayName, strategy: 'twitter' };
6930
if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; }
6931
return cb(null, user);
@@ -6935,10 +6939,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6939
const GoogleStrategy = require('passport-google-oauth20');
6940
var options = { clientID: domain.authstrategies.google.clientid, clientSecret: domain.authstrategies.google.clientsecret };
6941
if (typeof domain.authstrategies.google.callbackurl == 'string') { options.callbackURL = domain.authstrategies.google.callbackurl; } else { options.callbackURL = url + 'auth-google-callback'; }
6938
- parent.debug('web', 'Adding Google SSO with options: ' + JSON.stringify(options));
6942
+ parent.debug('authlog', 'Adding Google SSO with options: ' + JSON.stringify(options));
6943
passport.use('google-' + domain.id, new GoogleStrategy(options,
6944
function (token, tokenSecret, profile, cb) {
6941
- parent.debug('web', 'Google profile: ' + JSON.stringify(profile));
6945
+ parent.debug('authlog', 'Google profile: ' + JSON.stringify(profile));
6946
var user = { sid: '~google:' + profile.id, name: profile.displayName, strategy: 'google' };
6947
if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string') && (profile.emails[0].verified == true)) { user.email = profile.emails[0].value; }
6948
return cb(null, user);
@@ -6952,10 +6956,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6956
const GitHubStrategy = require('passport-github2');
6957
var options = { clientID: domain.authstrategies.github.clientid, clientSecret: domain.authstrategies.github.clientsecret };
6958
if (typeof domain.authstrategies.github.callbackurl == 'string') { options.callbackURL = domain.authstrategies.github.callbackurl; } else { options.callbackURL = url + 'auth-github-callback'; }
6955
- parent.debug('web', 'Adding Github SSO with options: ' + JSON.stringify(options));
6959
+ parent.debug('authlog', 'Adding Github SSO with options: ' + JSON.stringify(options));
6960
passport.use('github-' + domain.id, new GitHubStrategy(options,
6961
function (token, tokenSecret, profile, cb) {
6958
- parent.debug('web', 'Github profile: ' + JSON.stringify(profile));
6962
+ parent.debug('authlog', 'Github profile: ' + JSON.stringify(profile));
6963
var user = { sid: '~github:' + profile.id, name: profile.displayName, strategy: 'github' };
6964
if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; }
6965
return cb(null, user);
@@ -6969,10 +6973,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6973
const RedditStrategy = require('passport-reddit');
6974
var options = { clientID: domain.authstrategies.reddit.clientid, clientSecret: domain.authstrategies.reddit.clientsecret };
6975
if (typeof domain.authstrategies.reddit.callbackurl == 'string') { options.callbackURL = domain.authstrategies.reddit.callbackurl; } else { options.callbackURL = url + 'auth-reddit-callback'; }
6972
- parent.debug('web', 'Adding Reddit SSO with options: ' + JSON.stringify(options));
6976
+ parent.debug('authlog', 'Adding Reddit SSO with options: ' + JSON.stringify(options));
6977
passport.use('reddit-' + domain.id, new RedditStrategy.Strategy(options,
6978
function (token, tokenSecret, profile, cb) {
6975
- parent.debug('web', 'Reddit profile: ' + JSON.stringify(profile));
6979
+ parent.debug('authlog', 'Reddit profile: ' + JSON.stringify(profile));
6980
var user = { sid: '~reddit:' + profile.id, name: profile.name, strategy: 'reddit' };
6981
if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; }
6982
return cb(null, user);
@@ -6986,12 +6990,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6990
const AzureOAuth2Strategy = require('passport-azure-oauth2');
6991
var options = { clientID: domain.authstrategies.azure.clientid, clientSecret: domain.authstrategies.azure.clientsecret, tenant: domain.authstrategies.azure.tenantid };
6992
if (typeof domain.authstrategies.azure.callbackurl == 'string') { options.callbackURL = domain.authstrategies.azure.callbackurl; } else { options.callbackURL = url + 'auth-azure-callback'; }
6989
- parent.debug('web', 'Adding Azure SSO with options: ' + JSON.stringify(options));
6993
+ parent.debug('authlog', 'Adding Azure SSO with options: ' + JSON.stringify(options));
6994
passport.use('azure-' + domain.id, new AzureOAuth2Strategy(options,
6995
function (accessToken, refreshtoken, params, profile, done) {
6996
var userex = null;
6997
try { userex = require('jwt-simple').decode(params.id_token, '', true); } catch (ex) { }
6994
- parent.debug('web', 'Azure profile: ' + JSON.stringify(userex));
6998
+ parent.debug('authlog', 'Azure profile: ' + JSON.stringify(userex));
6999
var user = null;
7000
if (userex != null) {
7001
var user = { sid: '~azure:' + userex.unique_name, name: userex.name, strategy: 'azure' };
@@ -7010,29 +7014,30 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7014
issuer: domain.authstrategies.oidc.issuer,
7015
clientID: domain.authstrategies.oidc.clientid,
7016
clientSecret: domain.authstrategies.oidc.clientsecret,
7013
- scope: ['profile', 'email', 'groups'],
7017
+ scope: ['profile', 'email'],
7018
};
7019
const discoverOptions = async function(options){
7020
if ((typeof domain.authstrategies.oidc.authorizationurl != 'string') || (typeof domain.authstrategies.oidc.tokenurl != 'string') || (typeof domain.authstrategies.oidc.userinfourl != 'string')) {
7021
const Issuer = require('openid-client').Issuer;
7018
- parent.debug('authlog', 'OpenID: Attempting to discover well known endpoints for ' + options.issuer);
7022
+ parent.debug('authlog', `OIDC: Attempting to discover well known endpoints for ${options.issuer}`);
7023
var issuer = await Issuer.discover(options.issuer)
7024
if (typeof domain.authstrategies.oidc.authorizationurl == 'string') { options.authorizationURL = domain.authstrategies.oidc.authorizationurl; } else { options.authorizationURL = issuer.metadata.authorization_endpoint; }
7025
if (typeof domain.authstrategies.oidc.tokenurl == 'string') { options.tokenURL = domain.authstrategies.oidc.tokenurl; } else { options.tokenURL = issuer.metadata.token_endpoint; }
7026
if (typeof domain.authstrategies.oidc.userinfourl == 'string') { options.userInfoURL = domain.authstrategies.oidc.userinfourl; } else { options.userInfoURL = issuer.metadata.userinfo_endpoint; }
7027
if (typeof domain.authstrategies.oidc.callbackurl == 'string') { options.callbackURL = domain.authstrategies.oidc.callbackurl; } else { options.callbackURL = url + 'oidc-callback'; }
7024
- parent.debug('authlog', 'OpenID: Discovered ' + JSON.stringify(options));
7028
+ parent.debug('authlog', 'OIDC: Discovered: ' + JSON.stringify(options, null, 4));
7029
}
7030
return options;
7031
}
7032
+ if (typeof domain.authstrategies.oidc.groups == 'object') { options.scope.push('groups') }
7033
discoverOptions(options).then(function(options) {
7034
passport.use('oidc-' + domain.id, new OIDCStrategy.Strategy(options,
7035
function verify(issuer, profile, verified) {
7031
- parent.debug('authlog', `OpenID: Connecting to ${issuer} with the following options ` + JSON.stringify(options));
7036
+ parent.debug('authlog', `OIDC: Connecting to ${issuer} with the following options ` + JSON.stringify(options, null, 4));
7037
var user = { sid: '~oidc:' + profile.id, name: profile.displayName, strategy: 'oidc' };
7033
- if ( Array.isArray(profile.emails[0].value) ) { user.email = profile.emails[0].value[0]; } else { user.email = profile.emails[0].value; }
7034
- if ( Array.isArray(profile.groups[0].value) ) { user.groups = profile.groups[0].value; } else { user.groups = [profile.groups[0].value]; }
7035
- parent.debug('authlog', `OpenID: Configured: User: ${JSON.stringify(user)} FROM Profile: ${JSON.stringify(profile)}`);
7038
+ if (typeof profile.emails == 'object') { if (typeof profile.emails[0].value == 'string') { user.email = profile.emails[0].value; } else { user.email = profile.emails[0].value[0]; } } else if (typeof profile.emails == 'string') { user.email = profile.emails; }
7039
+ if (options.scope.indexOf('groups') >= 0) { if ( Array.isArray(profile.groups[0].value) ) { user.groups = profile.groups[0].value; } else { user.groups = [profile.groups[0].value]; } }
7040
+ parent.debug('authlog', `oidc: Configured:\nUser: ${JSON.stringify(user, null, 4)}\nFROM\nProfile: ${JSON.stringify(profile, null, 4)}`);
7041
return verified(null, user);
7042
}
7043
))
@@ -7054,12 +7059,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7059
if (typeof domain.authstrategies.saml.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.saml.callbackurl; } else { options.callbackUrl = url + 'auth-saml-callback'; }
7060
if (domain.authstrategies.saml.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.saml.disablerequestedauthncontext; }
7061
if (typeof domain.authstrategies.saml.entityid == 'string') { options.issuer = domain.authstrategies.saml.entityid; }
7057
- parent.debug('web', 'Adding SAML SSO with options: ' + JSON.stringify(options));
7062
+ parent.debug('authlog', 'Adding SAML SSO with options: ' + JSON.stringify(options, null, 4));
7063
options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join('');
7064
const SamlStrategy = require('passport-saml').Strategy;
7065
passport.use('saml-' + domain.id, new SamlStrategy(options,
7066
function (profile, done) {
7062
- parent.debug('web', 'SAML profile: ' + JSON.stringify(profile));
7067
+ parent.debug('authlog', 'SAML profile: ' + JSON.stringify(profile, null, 4));
7068
if (typeof profile.nameID != 'string') { return done(); }
7069
var user = { sid: '~saml:' + profile.nameID, name: profile.nameID, strategy: 'saml' };
7070
if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
@@ -7085,12 +7090,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7090
if (typeof domain.authstrategies.intel.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.intel.callbackurl; } else { options.callbackUrl = url + 'auth-intel-callback'; }
7091
if (domain.authstrategies.intel.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.intel.disablerequestedauthncontext; }
7092
if (typeof domain.authstrategies.intel.entityid == 'string') { options.issuer = domain.authstrategies.intel.entityid; }
7088
- parent.debug('web', 'Adding Intel SSO with options: ' + JSON.stringify(options));
7093
+ parent.debug('authlog', 'Adding Intel SSO with options: ' + JSON.stringify(options, null, 4));
7094
options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join('');
7095
const SamlStrategy = require('passport-saml').Strategy;
7096
passport.use('isaml-' + domain.id, new SamlStrategy(options,
7097
function (profile, done) {
7093
- parent.debug('web', 'Intel profile: ' + JSON.stringify(profile));
7098
+ parent.debug('authlog', 'Intel profile: ' + JSON.stringify(profile, null, 4));
7099
if (typeof profile.nameID != 'string') { return done(); }
7100
var user = { sid: '~intel:' + profile.nameID, name: profile.nameID, strategy: 'intel' };
7101
if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
@@ -7117,12 +7122,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7122
var options = { entryPoint: domain.authstrategies.jumpcloud.idpurl, issuer: 'meshcentral' };
7123
if (typeof domain.authstrategies.jumpcloud.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.jumpcloud.callbackurl; } else { options.callbackUrl = url + 'auth-jumpcloud-callback'; }
7124
if (typeof domain.authstrategies.jumpcloud.entityid == 'string') { options.issuer = domain.authstrategies.jumpcloud.entityid; }
7120
- parent.debug('web', 'Adding JumpCloud SSO with options: ' + JSON.stringify(options));
7125
+ parent.debug('authlog', 'Adding JumpCloud SSO with options: ' + JSON.stringify(options, null, 4));
7126
options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join('');
7127
const SamlStrategy = require('passport-saml').Strategy;
7128
passport.use('jumpcloud-' + domain.id, new SamlStrategy(options,
7129
function (profile, done) {
7125
- parent.debug('web', 'JumpCloud profile: ' + JSON.stringify(profile));
7130
+ parent.debug('authlog', 'JumpCloud profile: ' + JSON.stringify(profile, null, 4));
7131
if (typeof profile.nameID != 'string') { return done(); }
7132
var user = { sid: '~jumpcloud:' + profile.nameID, name: profile.nameID, strategy: 'jumpcloud' };
7133
if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }