Azure Ggroups and roles again (#7775)
* Add files via upload * Add files via upload
stephannn committed
May 16, 2026 at 10:19 UTC
f09247e1eba81a660ffb387773192a5a9c9f2502
1 file changed
+12
-10
webserver.js
+12
-10
@@ -8501,15 +8501,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
8501
if((Array.isArray(strategy.custom.authorities) && strategy.custom.authorities.filter(x => x.trim().length > 0).length > 0) == false || strategy.custom.authorities.includes('groups')) {
8502
getGroups(user.preset, tokenset).then((groups) => {
8503
user = Object.assign(user, { 'groups': groups });
8504
-
8505
- if(strategy.custom.authorities.includes('roles')){
8506
- if(user.roles){
8507
- if(!strategy.custom.authorities.includes('groups')){
8508
- user.groups = user.roles;
8509
- } else {
8510
- user.groups = (user.groups || []).concat(user.roles);
8511
- }
8512
- }
8504
+ if(strategy.custom.authorities && strategy.custom.authorities.includes('roles')){
8505
+ // Check also for roles
8506
+ user.groups = (user.groups || []).concat(user.roles);
8507
}
8508
parent.authLog('oidcCallback',`OIDC: USER GROUPS/ROLES: ${JSON.stringify(user)}`);
8509
done(null, user);
@@ -8520,7 +8514,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
8514
user.groups = [];
8515
done(null, user);
8516
});
8523
- }
8517
+
8518
+ } else if (Array.isArray(strategy.custom.authorities) && strategy.custom.authorities.includes('roles')) {
8519
+ // Only roles are requested
8520
+ if (user.roles) {
8521
+ user.groups = user.roles;
8522
+ }
8523
+ parent.authLog('OIDC: USER ROLES:', user);
8524
+ done(null, user);
8525
+ }
8526
} else {
8527
done(null, user);
8528
}