-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: invalidAn issue that we don't feel is validAn issue that we don't feel is validtype: bugA general bugA general bugtype: jiraAn issue that was migrated from JIRAAn issue that was migrated from JIRA
Description
Benjamin Muschko (Migrated from SEC-1925) said:
In my project I defined multiple hierarchical roles e.g. ROLE_USER > SOME_OTHER_ROLE. When securing controller methods using the @Secured
annotation it works just fine. However, I also would like to check the role programmatically in my code for one use case. Using the following approach I always get a false
even though the user inherits the role through hierarchical role definition:
SecurityContextHolderAwareRequestWrapper#isUserInRole(String)
Also getting the roles via SecurityContextHolder.getContext().getAuthentication().getAuthorities()
doesn't give me the hierarchical roles. I'd expect them to be retrieved as well.
This might be a bug in SecurityContextHolderAwareRequestWrapper. Right now I am using this method to make it work:
RoleVoter#extractAuthorities(Authentication)
Metadata
Metadata
Assignees
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: invalidAn issue that we don't feel is validAn issue that we don't feel is validtype: bugA general bugA general bugtype: jiraAn issue that was migrated from JIRAAn issue that was migrated from JIRA