Class CustomAuthenticationProvider

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

    @Service("customAuthenticationProvider")
    public class CustomAuthenticationProvider
    extends Object
    implements org.springframework.security.authentication.AuthenticationProvider
    Implements method from AuthenticationProvider in order to capture and store the password from spring-security objects. It returns an Authentication object filled with username, password and roles assigned to the user. This case, this method intercepts Authentication process from spring-security, contacts to OKM using webservices calls and sets roles to the user. It also stores OKM ws object in cache and it is also able to store somewhere credentials for further access by means of SecurityContextHolder http://www.baeldung.com/spring-security-authentication-provider and http://www.baeldung.com/spring-security-login for configuration It is also possible to extend DAOAuthenticationProvider (http://stackoverflow.com/questions/18220556/how-to-implement-custom-authentication-in-spring-security-3#comment27182355_18224564)
    • Constructor Detail

      • CustomAuthenticationProvider

        public CustomAuthenticationProvider()
    • Method Detail

      • authenticate

        public org.springframework.security.core.Authentication authenticate​(org.springframework.security.core.Authentication authentication)
                                                                      throws org.springframework.security.core.AuthenticationException
        Specified by:
        authenticate in interface org.springframework.security.authentication.AuthenticationProvider
        Throws:
        org.springframework.security.core.AuthenticationException
      • supports

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