Results 1 to 2 of 2

Thread: Role prefix

  1. #1
    Join Date
    Dec 2004
    Location
    Bucuresti, Romania
    Posts
    72

    Default Role prefix

    Hi,
    I am starting with Acegy Security and I have come accros this:
    I took the sample application and tried to modify the names of the roles not to start with ROLE_ . I don't want to use any prefix for my roles, because it looks ugly when sorting, but this is just my opinion. But this did not work by just updating the database, because an IllegalArgmentException is thrown. This is caused because RoleVoter has the default role prefix set to ROLE_.
    Code:
     private String rolePrefix = "ROLE_";
    I have set the rolePrefix property to an empty string and everything worked after that; but wouldn't it be nice to have an empty string as the default role prefix?

    After all, why is there a need for a role prefix thing ? Should the framework provide this functionality which does not bring much advantage?

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

    Default Re: Role prefix

    Quote Originally Posted by croco
    I have set the rolePrefix property to an empty string and everything worked after that; but wouldn't it be nice to have an empty string as the default role prefix?

    After all, why is there a need for a role prefix thing ? Should the framework provide this functionality which does not bring much advantage?
    Configuration attributes are used for far more than just RoleVoter. They are frequently by custom AccessDecisionVoters, AfterInvocationManagers, and RunAsManagers. Each potential user of configuration attribute information therefore needs to identify configuration attributes only of interest to it. This can be done with string.beginsWith() type methods - as we do - or by passing different ConfigAttribute concrete classes around. The problem with the latter approach is it complicates people's efforts to write PropertyEditors and AuthenticationDaos, as they need to discriminate based on class and not merely content of SecurityConfig.

    Hope this clarifies a little about the rationale.

Similar Threads

  1. LDAPPasswordAuthenticationDao problem
    By benoit_m35 in forum Security
    Replies: 15
    Last Post: Jan 11th, 2006, 07:04 AM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Is a blank allowed in a Role name?
    By pjydc in forum Security
    Replies: 1
    Last Post: May 5th, 2005, 10:48 PM
  4. Replies: 3
    Last Post: Jan 30th, 2005, 03:43 PM
  5. Replies: 1
    Last Post: Aug 27th, 2004, 05:32 PM

Posting Permissions

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