org.springframework.social.security
Class SocialAuthenticationProvider
java.lang.Object
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 ServiceProvider
s
- Author:
- Stefan Fussennegger, Yuan Ji
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 |
SocialAuthenticationProvider
public SocialAuthenticationProvider(UsersConnectionRepository usersConnectionRepository,
SocialUserDetailsService userDetailsService)
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
iduserDetails
- UserDetails
as returned by SocialUserDetailsService
- Returns:
- extra authorities of this user not already returned by
UserDetails.getAuthorities()