Spring Security Framework

org.springframework.security.authoritymapping
Class MapBasedAttributes2GrantedAuthoritiesMapper

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

public class MapBasedAttributes2GrantedAuthoritiesMapper
extends Object
implements Attributes2GrantedAuthoritiesMapper, MappableAttributesRetriever, InitializingBean

This class implements the Attributes2GrantedAuthoritiesMapper and MappableAttributesRetriever interfaces based on the supplied Map. It supports both one-to-one and one-to-many mappings. The granted authorities to map to can be supplied either as a String or as a GrantedAuthority object.

Author:
Ruud Senden

Constructor Summary
MapBasedAttributes2GrantedAuthoritiesMapper()
           
 
Method Summary
 void afterPropertiesSet()
          Check whether all properties have been set to correct values, and do some preprocessing.
 Map getAttributes2grantedAuthoritiesMap()
           
 GrantedAuthority[] getGrantedAuthorities(String[] attributes)
          Map the given array of attributes to Spring Security GrantedAuthorities.
 String[] getMappableAttributes()
          Implementations of this method should return a list of all string attributes which can be mapped to GrantedAuthoritys.
 String getStringSeparator()
           
 void setAttributes2grantedAuthoritiesMap(Map attributes2grantedAuthoritiesMap)
           
 void setStringSeparator(String stringSeparator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapBasedAttributes2GrantedAuthoritiesMapper

public MapBasedAttributes2GrantedAuthoritiesMapper()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Check whether all properties have been set to correct values, and do some preprocessing.

Specified by:
afterPropertiesSet in interface InitializingBean

getGrantedAuthorities

public GrantedAuthority[] getGrantedAuthorities(String[] attributes)
Map the given array of attributes to Spring Security GrantedAuthorities.

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

getAttributes2grantedAuthoritiesMap

public Map getAttributes2grantedAuthoritiesMap()
Returns:
Returns the attributes2grantedAuthoritiesMap.

setAttributes2grantedAuthoritiesMap

public void setAttributes2grantedAuthoritiesMap(Map attributes2grantedAuthoritiesMap)
Parameters:
attributes2grantedAuthoritiesMap - The attributes2grantedAuthoritiesMap to set.

getMappableAttributes

public String[] getMappableAttributes()
Description copied from interface: MappableAttributesRetriever
Implementations of this method should return a list of all string attributes which can be mapped to GrantedAuthoritys.

Specified by:
getMappableAttributes in interface MappableAttributesRetriever
Returns:
list of all mappable roles
See Also:
MappableAttributesRetriever.getMappableAttributes()

getStringSeparator

public String getStringSeparator()
Returns:
Returns the stringSeparator.

setStringSeparator

public void setStringSeparator(String stringSeparator)
Parameters:
stringSeparator - The stringSeparator to set.

Spring Security Framework

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