Class LdaptiveAuthenticationManager

java.lang.Object
org.bremersee.spring.security.ldaptive.authentication.LdaptiveAuthenticationManager
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.MessageSourceAware, org.springframework.security.authentication.AuthenticationManager, org.springframework.security.authentication.AuthenticationProvider

public class LdaptiveAuthenticationManager extends Object implements org.springframework.security.authentication.AuthenticationManager, org.springframework.security.authentication.AuthenticationProvider, org.springframework.context.MessageSourceAware
The ldaptive authentication manager.
Author:
Christian Bremer
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
      The Logger.
  • Constructor Details

    • LdaptiveAuthenticationManager

      public LdaptiveAuthenticationManager(org.ldaptive.ConnectionConfig connectionConfig, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey)
      Instantiates a new ldaptive authentication manager.
      Parameters:
      connectionConfig - the connection config
      authenticationProperties - the authentication properties
      rememberMeKey - the remember me key
    • LdaptiveAuthenticationManager

      public LdaptiveAuthenticationManager(org.ldaptive.ConnectionFactory connectionFactory, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey)
      Instantiates a new ldaptive authentication manager.
      Parameters:
      connectionFactory - the connection factory
      authenticationProperties - the authentication properties
      rememberMeKey - the remember me key
    • LdaptiveAuthenticationManager

      public LdaptiveAuthenticationManager(org.bremersee.ldaptive.LdaptiveTemplate applicationLdaptiveTemplate, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey)
      Instantiates a new ldaptive authentication manager.
      Parameters:
      applicationLdaptiveTemplate - the application ldaptive template
      authenticationProperties - the authentication properties
      rememberMeKey - the remember me key
  • Method Details

    • setEmailToUsernameResolver

      public void setEmailToUsernameResolver(org.bremersee.spring.security.core.EmailToUsernameResolver emailToUsernameResolver)
      Sets email to username resolver.
      Parameters:
      emailToUsernameResolver - the email to username resolver
    • setAccountControlEvaluator

      public void setAccountControlEvaluator(AccountControlEvaluator accountControlEvaluator)
      Sets account control evaluator.
      Parameters:
      accountControlEvaluator - the account control evaluator
    • setMessageSource

      public void setMessageSource(@NonNull org.springframework.context.MessageSource messageSource)
      Specified by:
      setMessageSource in interface org.springframework.context.MessageSourceAware
    • init

      public void init()
      Init.
    • supports

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

      protected boolean rememberMeKeyMatches(org.springframework.security.authentication.RememberMeAuthenticationToken authentication)
      Remember me key matches given authentication.
      Parameters:
      authentication - the authentication
      Returns:
      the boolean
    • authenticate

      public @NonNull 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.AuthenticationManager
      Specified by:
      authenticate in interface org.springframework.security.authentication.AuthenticationProvider
      Throws:
      org.springframework.security.core.AuthenticationException
    • isRefusedUsername

      protected boolean isRefusedUsername(String username)
      Determines whether the username is refused by configuration.
      Parameters:
      username - the username
      Returns:
      true if the username is refused, otherwise false
    • getName

      protected String getName(org.springframework.security.core.Authentication authentication)
      Gets name.
      Parameters:
      authentication - the authentication
      Returns:
      the name
    • getUserDetailsService

      public LdaptiveUserDetailsService getUserDetailsService()
      Gets user details service.
      Returns:
      the user details service
    • isSimpleBindAuthentication

      protected boolean isSimpleBindAuthentication()
      Determines whether to bind with username and password or to compare the passwords.
      Returns:
      the boolean
    • checkPassword

      protected void checkPassword(LdaptiveUserDetails user, String password)
      Check password.
      Parameters:
      user - the user
      password - the password
    • checkPasswordWithCompareRequest

      protected void checkPasswordWithCompareRequest(LdaptiveUserDetails user, String password)
      Check password with compare request.
      Parameters:
      user - the user
      password - the password
    • checkPasswordWithSimpleBind

      protected void checkPasswordWithSimpleBind(LdaptiveUserDetails user, String password)
      Check password with simple bind.
      Parameters:
      user - the user
      password - the password
    • checkAccountControl

      protected void checkAccountControl(LdaptiveUserDetails user)
      Check account control.
      Parameters:
      user - the user