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 Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.commons.logging.LogThe Logger. -
Constructor Summary
ConstructorsConstructorDescriptionLdaptiveAuthenticationManager(org.bremersee.ldaptive.LdaptiveTemplate applicationLdaptiveTemplate, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey) Instantiates a new ldaptive authentication manager.LdaptiveAuthenticationManager(org.ldaptive.ConnectionConfig connectionConfig, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey) Instantiates a new ldaptive authentication manager.LdaptiveAuthenticationManager(org.ldaptive.ConnectionFactory connectionFactory, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey) Instantiates a new ldaptive authentication manager. -
Method Summary
Modifier and TypeMethodDescription@NonNull org.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication) protected voidCheck account control.protected voidcheckPassword(String userDn, String password) Check password.protected voidcheckPasswordWithCompareRequest(String userDn, String password) Check password with compare request.protected voidcheckPasswordWithSimpleBind(String userDn, String password) Check password with simple bind.protected voidcheckUsername(String username) Check username.protected org.ldaptive.BindOperationgetBindOperation(org.ldaptive.ConnectionFactory connectionFactory) Gets bind operation.protected org.bremersee.ldaptive.LdaptiveTemplategetLdaptiveTemplate(String userDn, String password) Gets ldaptive template.protected StringgetName(org.springframework.security.core.Authentication authentication) Gets name from authentication.protected org.ldaptive.SingleConnectionFactoryGets single connection factory.Gets user details service.protected LdaptiveUserDetailsServicegetUserDetailsService(String userDn, String password) Gets user details service.protected LdaptiveUserDetailsServicegetUserDetailsService(org.bremersee.ldaptive.LdaptiveTemplate ldaptiveTemplate) Gets user details service.voidinit()Init.protected booleanisRefusedUsername(String username) Determines whether the username is refused by configuration.protected booleanDetermines whether to bind with username and password or to compare the passwords.protected booleanrememberMeKeyMatches(org.springframework.security.authentication.RememberMeAuthenticationToken authentication) Remember me key matches given authentication.voidsetAccountControlEvaluator(AccountControlEvaluator accountControlEvaluator) Sets account control evaluator.voidsetMessageSource(@NonNull org.springframework.context.MessageSource messageSource) boolean
-
Field Details
-
logger
protected final org.apache.commons.logging.Log loggerThe Logger.
-
-
Constructor Details
-
LdaptiveAuthenticationManager
public LdaptiveAuthenticationManager(org.ldaptive.ConnectionConfig connectionConfig, LdaptiveAuthenticationProperties authenticationProperties, String rememberMeKey) Instantiates a new ldaptive authentication manager.- Parameters:
connectionConfig- the connection configauthenticationProperties- the authentication propertiesrememberMeKey- 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 factoryauthenticationProperties- the authentication propertiesrememberMeKey- 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 templateauthenticationProperties- the authentication propertiesrememberMeKey- the remember me key
-
-
Method Details
-
setAccountControlEvaluator
Sets account control evaluator.- Parameters:
accountControlEvaluator- the account control evaluator
-
setMessageSource
public void setMessageSource(@NonNull org.springframework.context.MessageSource messageSource) - Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware
-
init
public void init()Init. -
supports
- Specified by:
supportsin interfaceorg.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:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationManager- Specified by:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationProvider- Throws:
org.springframework.security.core.AuthenticationException
-
getName
Gets name from authentication.- Parameters:
authentication- the authentication- Returns:
- the name
-
getUserDetailsService
Gets user details service.- Returns:
- the user details service
-
getUserDetailsService
Gets user details service.- Parameters:
userDn- the user dnpassword- the password- 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
-
getLdaptiveTemplate
protected org.bremersee.ldaptive.LdaptiveTemplate getLdaptiveTemplate(String userDn, String password) Gets ldaptive template.- Parameters:
userDn- the user dnpassword- the password- Returns:
- the ldaptive template
-
isSimpleBindAuthentication
protected boolean isSimpleBindAuthentication()Determines whether to bind with username and password or to compare the passwords.- Returns:
- the boolean
-
checkPassword
Check password.- Parameters:
userDn- the distinguished name of the userpassword- the password
-
checkPasswordWithCompareRequest
Check password with compare request.- Parameters:
userDn- the distinguished name of the userpassword- the password
-
checkPasswordWithSimpleBind
Check password with simple bind.- Parameters:
userDn- the distinguished name of the userpassword- the password
-
checkUsername
Check username.- Parameters:
username- the username
-
isRefusedUsername
Determines whether the username is refused by configuration.- Parameters:
username- the username- Returns:
trueif the username is refused, otherwisefalse
-
getSingleConnectionFactory
protected org.ldaptive.SingleConnectionFactory getSingleConnectionFactory()Gets single connection factory.- Returns:
- the single connection factory
-
getBindOperation
protected org.ldaptive.BindOperation getBindOperation(org.ldaptive.ConnectionFactory connectionFactory) Gets bind operation.- Parameters:
connectionFactory- the connection factory- Returns:
- the bind operation
-
checkAccountControl
Check account control.- Parameters:
user- the user
-