Skip to content

Commit

Permalink
Fix jdbc scope validator invalid scope issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bhagyasakalanka committed Jun 26, 2024
1 parent 15fb88a commit bb39aae
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public class JDBCScopeValidator extends OAuth2ScopeValidator {
private static final String SCOPE_VALIDATOR_NAME = "Role based scope validator";
private static final String OPENID = "openid";
private static final String PRESERVE_CASE_SENSITIVITY = "preservedCaseSensitive";
private static final String SCOPE_VALIDATOR_PRESERVE_CASE_SENSITIVITY_CONFIG =
"OAuth.ScopeValidationPreserveCaseSensitivity";

private static final boolean SCOPE_VALIDATOR_PRESERVE_CASE_SENSITIVITY =
Boolean.parseBoolean(IdentityUtil.getProperty(SCOPE_VALIDATOR_PRESERVE_CASE_SENSITIVITY_CONFIG));

private static final Log log = LogFactory.getLog(JDBCScopeValidator.class);

Expand Down Expand Up @@ -411,7 +416,7 @@ private boolean isUserAuthorizedForScope(String scopeName, String[] userRoles, i

//Check if the user still has a valid role for this scope.
Set<String> scopeRoles = new HashSet<>(rolesOfScope);
if (preservedCaseSensitive) {
if (preservedCaseSensitive || SCOPE_VALIDATOR_PRESERVE_CASE_SENSITIVITY) {
rolesOfScope.retainAll(Arrays.asList(userRoles));
} else {
Set<String> rolesOfScopeLowerCase = new HashSet<>();
Expand Down

0 comments on commit bb39aae

Please sign in to comment.