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
    • setUsernameToBindDnConverter

      public void setUsernameToBindDnConverter(UsernameToBindDnConverter usernameToBindDnConverter)
      Sets username to bind dn converter.
      Parameters:
      usernameToBindDnConverter - the username to bind dn converter
    • 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(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 LdaptiveAuthentication 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
    • bindWithAuthentication

      protected boolean bindWithAuthentication()
      Determines whether to bind with username and password or with the application ldaptive template.
      Returns:
      the boolean
    • getLdapTemplate

      protected org.bremersee.ldaptive.LdaptiveTemplate getLdapTemplate(String username, String password)
      Gets ldap template.
      Parameters:
      username - the username
      password - the password
      Returns:
      the ldap template
    • getUserDetails

      protected LdaptiveUserDetails getUserDetails(org.bremersee.ldaptive.LdaptiveTemplate ldaptiveTemplate, String username)
      Gets user details.
      Parameters:
      ldaptiveTemplate - the ldaptive template
      username - the username
      Returns:
      the user details
    • getUserDetailsService

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

      protected LdaptiveUserDetailsService getUserDetailsService(org.bremersee.ldaptive.LdaptiveTemplate ldaptiveTemplate)
      Gets user details service.
      Parameters:
      ldaptiveTemplate - the ldaptive template
      Returns:
      the user details service
    • checkPassword

      protected void checkPassword(org.bremersee.ldaptive.LdaptiveTemplate ldaptiveTemplate, LdaptiveUserDetails user, String password)
      Check password.
      Parameters:
      ldaptiveTemplate - the ldaptive template
      user - the user
      password - the password
    • checkAccountControl

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