Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix to catch MisconfiguredUserException #8368

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,14 @@ private UserInfo consolidateUser(ApiUser apiUser, PartialOktaUser oktaUser) {
OrganizationRoles orgRoles =
getOrganizationRoles(Optional.ofNullable(oktaClaims), apiUser, isSiteAdmin);

_dbOrgRoleClaimsService.checkOrgRoleClaimsEquality(
List.of(oktaClaims),
List.of(_dbOrgRoleClaimsService.getOrganizationRoleClaims(apiUser)),
apiUser.getLoginEmail());
try {
_dbOrgRoleClaimsService.checkOrgRoleClaimsEquality(
List.of(oktaClaims),
List.of(_dbOrgRoleClaimsService.getOrganizationRoleClaims(apiUser)),
apiUser.getLoginEmail());
} catch (MisconfiguredUserException e) {
log.error("Misconfigured organizations in DB for User ID: {}", apiUser.getInternalId());
}
return new UserInfo(apiUser, Optional.of(orgRoles), isSiteAdmin, userStatus);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public List<OrganizationRoleClaims> getOrganizationRoleClaims(String username) {
public OrganizationRoleClaims getOrganizationRoleClaims(ApiUser user) {
Set<Organization> orgs = user.getOrganizations();
if (orgs.size() != 1) {
log.error("Misconfigured organizations in DB for User ID: {}", user.getInternalId());
log.error(
"Misconfigured organizations in DB for User ID: {}. Number of organizations for user was: {}",
user.getInternalId(),
orgs.size());
throw new MisconfiguredUserException();
}
Set<OrganizationRole> roles = user.getRoles();
Expand Down
Loading