mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-09-11 08:55:32 +03:00
fix oidc groups.claim undefined
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
b22e56b6d2
commit
1c8d664962
22
webserver.js
22
webserver.js
@ -7469,19 +7469,19 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
|||||||
function oidcCallback(tokenset, profile, verified) {
|
function oidcCallback(tokenset, profile, verified) {
|
||||||
// Initialize user object
|
// Initialize user object
|
||||||
let user = { 'strategy': 'oidc' }
|
let user = { 'strategy': 'oidc' }
|
||||||
let claims = obj.common.validateObject(strategy.custom.claims) ? strategy.custom.claims : null
|
let claims = obj.common.validateObject(strategy.custom.claims) ? strategy.custom.claims : null;
|
||||||
user.sid = obj.common.validateString(profile.sub) ? '~oidc:' + profile.sub : null
|
user.sid = obj.common.validateString(profile.sub) ? '~oidc:' + profile.sub : null;
|
||||||
user.name = obj.common.validateString(profile.name) ? profile.name : null
|
user.name = obj.common.validateString(profile.name) ? profile.name : null;
|
||||||
user.email = obj.common.validateString(profile.email) ? profile.email : null
|
user.email = obj.common.validateString(profile.email) ? profile.email : null;
|
||||||
if (claims != null) {
|
if (claims != null) {
|
||||||
user.sid = obj.common.validateString(profile[claims.uuid]) ? '~oidc:' + profile[claims.uuid] : user.sid
|
user.sid = obj.common.validateString(profile[claims.uuid]) ? '~oidc:' + profile[claims.uuid] : user.sid;
|
||||||
user.name = obj.common.validateString(profile[claims.name]) ? profile[claims.name] : user.name
|
user.name = obj.common.validateString(profile[claims.name]) ? profile[claims.name] : user.name;
|
||||||
user.email = obj.common.validateString(profile[claims.email]) ? profile[claims.email] : user.email
|
user.email = obj.common.validateString(profile[claims.email]) ? profile[claims.email] : user.email;
|
||||||
}
|
}
|
||||||
user.emailVerified = profile.email_verified ? profile.email_verified : obj.common.validateEmail(user.email),
|
user.emailVerified = profile.email_verified ? profile.email_verified : obj.common.validateEmail(user.email);
|
||||||
user.groups = obj.common.validateStrArray(profile.groups, 1) ? profile.groups : null
|
user.groups = obj.common.validateStrArray(profile.groups, 1) ? profile.groups : null;
|
||||||
user.preset = obj.common.validateString(strategy.custom.preset) ? strategy.custom.preset : null
|
user.preset = obj.common.validateString(strategy.custom.preset) ? strategy.custom.preset : null;
|
||||||
if (obj.common.validateString(strategy.groups.claim)) {
|
if (strategy.groups && obj.common.validateString(strategy.groups.claim)) {
|
||||||
user.groups = obj.common.validateStrArray(profile[strategy.groups.claim], 1) ? profile[strategy.groups.claim] : null
|
user.groups = obj.common.validateStrArray(profile[strategy.groups.claim], 1) ? profile[strategy.groups.claim] : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user