Skip to content

Commit

Permalink
Add Note about RoleHierarchy
Browse files Browse the repository at this point in the history
Closes gh-12766
  • Loading branch information
jzheaux committed Feb 24, 2023
1 parent bbd31f0 commit 109f6e7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ AccessDecisionVoter hierarchyVoter() {
----
====

[NOTE]
`RoleHierarchy` bean configuration is not yet ported over to `@EnableMethodSecurity`.
As such this example is using `AccessDecisionVoter`.
If you need `RoleHierarchy` support for method security, please continue using `@EnableGlobalMethodSecurity` until https://github.com/spring-projects/spring-security/issues/12783 is complete.

Here we have four roles in a hierarchy `ROLE_ADMIN => ROLE_STAFF => ROLE_USER => ROLE_GUEST`.
A user who is authenticated with `ROLE_ADMIN`, will behave as if they have all four roles when security constraints are evaluated against an `AuthorizationManager` adapted to call the above `RoleHierarchyVoter`.
The `>` symbol can be thought of as meaning "includes".
Expand Down

0 comments on commit 109f6e7

Please sign in to comment.