Announcement Announcement Module
Collapse
No announcement yet.
RoleVoter - any prefix Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RoleVoter - any prefix

    As stated, RoleVoter only votes when the secured resource has configuration
    attributes that are prefixed with ROLE_. However, the ROLE_ prefix is only a default.
    You may choose to override the default prefix by setting the rolePrefix property:
    Code:
    <bean id="roleVoter"
    class="net.sf.acegisecurity.vote.RoleVoter">
    <property name="rolePrefix">
    <value>GROUP_</value>
    </property>
    </bean>
    But what if I want any prefix, so user with role XXX or YYY could be authenticate (undependent of role prefix). I try * but it didn't work.
    Can you help me?

  • #2
    Have you tried an empty String?

    <value></value>

    Comment


    • #3
      The empty string approach suggested above would work. Equally, you could change your UserDetailsService to add GrantedAuthority[]s to the UserDetails which have a ROLE_ prefix. That way you need not change the ROLE_ prefix and you don't lock yourself out of using other voters in the future. For example, if you wanted to use ROLE_FOOBAR but later a CUSTOM_VOTER_XYZ or one of the ACL voters.

      Comment

      Working...
      X