Class SocialAuthenticationProvider

  • All Implemented Interfaces:
    org.springframework.security.authentication.AuthenticationProvider

    public class SocialAuthenticationProvider
    extends Object
    implements org.springframework.security.authentication.AuthenticationProvider
    AuthenticationProvider for spring-social based ServiceProviders
    Author:
    Stefan Fussennegger, Yuan Ji
    • Method Detail

      • supports

        public boolean supports​(Class<? extends 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
      • getAuthorities

        protected Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities​(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()