Spring Social

org.springframework.social.security
Class SocialAuthenticationProvider

java.lang.Object
  extended by org.springframework.social.security.SocialAuthenticationProvider
All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider

public class SocialAuthenticationProvider
extends java.lang.Object
implements org.springframework.security.authentication.AuthenticationProvider

AuthenticationProvider for spring-social based ServiceProviders

Author:
Stefan Fussennegger, Yuan Ji

Constructor Summary
SocialAuthenticationProvider(UsersConnectionRepository usersConnectionRepository, SocialUserDetailsService userDetailsService)
           
 
Method Summary
 org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication)
          Authenticate user based on SocialAuthenticationToken
protected  java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities(java.lang.String providerId, org.springframework.security.core.userdetails.UserDetails userDetails)
          Override to grant authorities based on ServiceProvider id and/or a user's account id
 boolean supports(java.lang.Class<? extends java.lang.Object> authentication)
           
protected  java.lang.String toUserId(Connection<?> connection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialAuthenticationProvider

public SocialAuthenticationProvider(UsersConnectionRepository usersConnectionRepository,
                                    SocialUserDetailsService userDetailsService)
Method Detail

supports

public boolean supports(java.lang.Class<? extends java.lang.Object> authentication)
Specified by:
supports in interface org.springframework.security.authentication.AuthenticationProvider

authenticate

public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication)
                                                              throws org.springframework.security.core.AuthenticationException
Authenticate user based on SocialAuthenticationToken

Specified by:
authenticate in interface org.springframework.security.authentication.AuthenticationProvider
Throws:
org.springframework.security.core.AuthenticationException

toUserId

protected java.lang.String toUserId(Connection<?> connection)

getAuthorities

protected java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities(java.lang.String providerId,
                                                                                                            org.springframework.security.core.userdetails.UserDetails userDetails)
Override to grant authorities based on ServiceProvider id and/or a user's account id

Parameters:
providerId - ServiceProvider id
userDetails - UserDetails as returned by SocialUserDetailsService
Returns:
extra authorities of this user not already returned by UserDetails.getAuthorities()

Spring Social