In Spring Boot 2.7.x , I used the RoleHierarchyVoter
public RoleHierarchy roleHierarchy() {
RoleHierarchyImpl roleHierarchy = new RoleHierarchyImpl();
roleHierarchy.setHierarchy("ROLE_ADMINISTRATOR > ROLE_USER > ROLE_GUEST");
return roleHierarchy;
}
@Bean
public RoleHierarchyVoter roleVoter() {
return new RoleHierarchyVoter(roleHierarchy());
}
In Spring Boot 3.x AccessDecisionVoter
are deprecated - the use of AuthorizationManager
is recommended. Is there any posibility to use an AuthorizationManager-Implementation to set a role hierarchy? The usage of
@Bean
AccessDecisionVoter hierarchyVoter() {
RoleHierarchy hierarchy = new RoleHierarchyImpl();
hierarchy.setHierarchy("ROLE_ADMIN > ROLE_STAFF > ROLE_USER" +
"ROLE_USER > ROLE_GUEST");
return new RoleHierarchyVoter(hierarchy);
}
did not work since I use the AuthorizationFilter
.