Hi,

When you want to use the net.sf.acegisecurity.vote.RoleVoter you must use
this prefix (unless you create a subclass of RoleVoter working with some
differet prefix, but it doesn't make sence to do this). You can have any
other config attribute names for your custom voters.

I imagine that you ask this question, because you have some role names in
your database, but without the "ROLE_" prefix. That's not a problem, you can
use code similar to this:

public GrantedAuthority[] getAuthorities() {
  if (authorities==null) {
    authorities = new GrantedAuthority[roles.size()];
    Iterator iterator = roles.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
      authorities[i] = new GrantedAuthorityImpl("ROLE_" +
((String)iterator.next()).toUpperCase());
    }
  }
  return authorities;
}

Regards,
Karel

----- Original Message ----- 
From: "Daniel Washusen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 13, 2004 12:21 PM
Subject: [Acegisecurity-developer] Is the "ROLE_" prefix required for all
roles?


> Hi All,
> I've been mucking around Acegi for a few days now and I'm curious the
> the "ROLE_" prefix, that, as far as I can tell is mandatory.  Can
> anyone confirm this?
>
> If I make my role deffinitions look like "/secure/**=ROLE_BLOGGER" it
> seems to work fine, but if I specifiy a role of "/secure/**=BLOGGER" I
> get an error when my webapp launches...
>
> Error:
> --------------------------------------------------------------
> 20:19:03,281 ERROR [ContextLoader] Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name filterInvocationInterceptor' defined in
> resource [/WEB-INF/classes/resources/spring/applicationContext.xml] of
> ServletContext: Initialization of bean failed; nested exception is
> java.lang.IllegalArgumentException: Unsupported configuration
> attributes: [ADMIN]
> java.lang.IllegalArgumentException: Unsupported configuration
> attributes: [ADMIN]
>         at
net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.afterPropertiesSe
t(AbstractSecurityInterceptor.jav
> ...
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Acegisecurity-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>
>




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Acegisecurity-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to