Results 1 to 3 of 3

Thread: RoleVoter - any prefix

  1. #1
    Join Date
    Nov 2005
    Posts
    10

    Default 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. #2
    Join Date
    Sep 2005
    Posts
    23

    Default

    Have you tried an empty String?

    <value></value>

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •