org.springframework.security.oauth2.provider.token
Class DefaultUserAuthenticationConverter

java.lang.Object
  extended by org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter
All Implemented Interfaces:
UserAuthenticationConverter

public class DefaultUserAuthenticationConverter
extends Object
implements UserAuthenticationConverter

Default implementation of UserAuthenticationConverter. Converts to and from an Authentication using only its name and authorities.

Author:
Dave Syer

Constructor Summary
DefaultUserAuthenticationConverter()
           
 
Method Summary
 Map<String,?> convertUserAuthentication(org.springframework.security.core.Authentication authentication)
          Extract information about the user to be used in an access token (i.e.
 org.springframework.security.core.Authentication extractAuthentication(Map<String,?> map)
          Inverse of UserAuthenticationConverter.convertUserAuthentication(Authentication).
 void setDefaultAuthorities(String[] defaultAuthorities)
          Default value for authorities if an Authentication is being created and the input has no data for authorities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserAuthenticationConverter

public DefaultUserAuthenticationConverter()
Method Detail

setDefaultAuthorities

public void setDefaultAuthorities(String[] defaultAuthorities)
Default value for authorities if an Authentication is being created and the input has no data for authorities. Note that unless this property is set, the default Authentication created by extractAuthentication(Map) will be unauthenticated.

Parameters:
defaultAuthorities - the defaultAuthorities to set. Default null.

convertUserAuthentication

public Map<String,?> convertUserAuthentication(org.springframework.security.core.Authentication authentication)
Description copied from interface: UserAuthenticationConverter
Extract information about the user to be used in an access token (i.e. for resource servers).

Specified by:
convertUserAuthentication in interface UserAuthenticationConverter
Parameters:
authentication - an authentication representing a user
Returns:
a map of key values representing the unique information about the user

extractAuthentication

public org.springframework.security.core.Authentication extractAuthentication(Map<String,?> map)
Description copied from interface: UserAuthenticationConverter
Inverse of UserAuthenticationConverter.convertUserAuthentication(Authentication). Extracts an Authentication from a map.

Specified by:
extractAuthentication in interface UserAuthenticationConverter
Parameters:
map - a map of user information
Returns:
an Authentication representing the user or null if there is none


Copyright © 2013. All rights reserved.