I'm working on a spring boot project v2.1.7 and I'm implementing the security with spring security.
In my case I've detected some hierarchies on roles and for this reason my current RoleHierarchy bean is as following
@Bean
public RoleHierarchy roleHierarchy() {
RoleHierarchyImpl roleHierarchy = new RoleHierarchyImpl();
roleHierarchy.setHierarchy("ROLE_ADMIN > ROLE_USER");
return roleHierarchy;
}
Now I need a new role called "BACK_OFFICE" that is less than ADMIN but doesn't have any link with the user role.
How can I represents this situation? I've tried with the following string representation but doens't works.
@Bean
public RoleHierarchy roleHierarchy() {
RoleHierarchyImpl roleHierarchy = new RoleHierarchyImpl();
roleHierarchy.setHierarchy("ROLE_ADMIN > ROLE_USER ROLE_ADMIN > ROLE_BACK_OFFICE");
return roleHierarchy;
}
Where is my error?