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

Fix: SCIM error handling for group display name (fixes #20344) #557

Closed
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,13 @@ private void doUpdateGroups(String roleId, Set<String> newGroupIDList, Set<Strin
new ArrayList<>(deleteGroupIDList), tenantDomain);
} catch (IdentityRoleManagementException e) {
if (RoleConstants.Error.INVALID_REQUEST.getCode().equals(e.getErrorCode())) {
throw new BadRequestException(e.getMessage());
// Error message and SCIM type
String errorMessage = "Updating groups of the role by display name is not supported. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct place to handle the mentioned error?
Issue should be directly taking display eq ... something as group id
We have to throw the error from that place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b974ba9

+ "Update using group id instead.";
String scimType = "invalidSyntax"; // From RFC 7644 Table 9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without hardcoding here you can directly use ResponseCodeConstants.INVALID_SYNTAX constant in charon

scimType variable is also redundant then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b974ba9


// Throw BadRequestException with custom message and scimType
throw new BadRequestException(errorMessage, scimType);
}
throw new CharonException(
String.format("Error occurred while updating groups in the role with ID: %s", roleId), e);
Expand Down
Loading