Skip to content

Commit

Permalink
fix: using a few openIds for user
Browse files Browse the repository at this point in the history
  • Loading branch information
nightnei committed Dec 22, 2021
1 parent d86f28b commit 3c7cede
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions registry/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,16 @@ export default (app: Express, settingsService: SettingsService, config: any): Re
identifiers = [identifiers];
}

let user: any;
let user: User | null = null;
for (let id of identifiers) {
user = await getEntityWithCreds('openid', id, null);
if (user) {
const entity = await getEntityWithCreds('openid', id, null);
if (!entity) {
continue;
}

user = entity;

if (entity.role === AuthRoles.admin) {
break;
}
}
Expand All @@ -157,7 +163,7 @@ export default (app: Express, settingsService: SettingsService, config: any): Re
return done(null, false, { message: `Can\'t find presented identifiers "${identifiers.toString()}" in auth entities list` });
}
if (uidClaimName && claims[uidClaimName]) {
user.identifier = claims[uidClaimName];
user.identifier = claims[uidClaimName] as string;
}

return done(null, user);
Expand Down

0 comments on commit 3c7cede

Please # to comment.