Spring Security Framework

org.springframework.security.authoritymapping
Class SimpleAttributes2GrantedAuthoritiesMapper

java.lang.Object
  extended by org.springframework.security.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper
All Implemented Interfaces:
InitializingBean, Attributes2GrantedAuthoritiesMapper

public class SimpleAttributes2GrantedAuthoritiesMapper
extends Object
implements Attributes2GrantedAuthoritiesMapper, InitializingBean

This class implements the Attributes2GrantedAuthoritiesMapper interface by doing a one-to-one mapping from roles to Spring Security GrantedAuthorities. Optionally a prefix can be added, and the attribute name can be converted to upper or lower case.

By default, the attribute is prefixed with "ROLE_" unless it already starts with "ROLE_", and no case conversion is done.

Since:
2.0
Author:
Ruud Senden

Constructor Summary
SimpleAttributes2GrantedAuthoritiesMapper()
           
 
Method Summary
 void afterPropertiesSet()
          Check whether all properties have been set to correct values.
 GrantedAuthority[] getGrantedAuthorities(String[] attributes)
          Map the given list of string attributes one-to-one to Spring Security GrantedAuthorities.
 void setAddPrefixIfAlreadyExisting(boolean b)
           
 void setAttributePrefix(String string)
           
 void setConvertAttributeToLowerCase(boolean b)
           
 void setConvertAttributeToUpperCase(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAttributes2GrantedAuthoritiesMapper

public SimpleAttributes2GrantedAuthoritiesMapper()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check whether all properties have been set to correct values.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getGrantedAuthorities

public GrantedAuthority[] getGrantedAuthorities(String[] attributes)
Map the given list of string attributes one-to-one to Spring Security GrantedAuthorities.

Specified by:
getGrantedAuthorities in interface Attributes2GrantedAuthoritiesMapper
Returns:
the list of mapped GrantedAuthorities

setConvertAttributeToLowerCase

public void setConvertAttributeToLowerCase(boolean b)

setConvertAttributeToUpperCase

public void setConvertAttributeToUpperCase(boolean b)

setAttributePrefix

public void setAttributePrefix(String string)

setAddPrefixIfAlreadyExisting

public void setAddPrefixIfAlreadyExisting(boolean b)

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.