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

Rectify use of preservedCaseSensitive system property #1829

Merged
merged 1 commit into from
Apr 19, 2022
Merged
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 @@ -86,6 +86,7 @@ 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 ATTRIBUTE_SEPARATOR = FrameworkUtils.getMultiAttributeSeparator();
private static final String PRESERVE_CASE_SENSITIVITY = "preservedCaseSensitive";

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

Expand Down Expand Up @@ -396,11 +397,11 @@ private boolean isUserAuthorizedForScope(String scopeName, String[] userRoles, i
}
return false;
}
boolean preservedCaseSensitive = Boolean.parseBoolean(System.getProperty("preservedCaseSensitive"));
boolean preservedCaseSensitive = Boolean.parseBoolean(System.getProperty(PRESERVE_CASE_SENSITIVITY));

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