IS_AUTHENTICATED_ANONYMOUSLY is defined in the AuthenticatedVoter class.
The various ROLE_xxxx are not particularly significant.
Spring Security offers these roles by default because they are used in most applications.
However, you can define and use custom roles (for example, ROLE_SUPERMAN).
You just need to make sure that the UserDetail
returned by your UserDetailService
has this ROLE
assigned as GrantedAuthority
(either from the database or manually).
Actually ROLE is a prefix. If you want to change it to APP (i.e. APP_ADMIN), you must define a custom AppVoter
:
<bean class="org.springframework.security.vote.RoleVoter"> <property name="rolePrefix" value="APP"/> </bean>
Γmit source share