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(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 TypeMethodDescriptionauthenticate(org.springframework.security.core.Authentication authentication) protected booleanDetermines whether to bind with username and password or with the application ldaptive template.protected voidCheck account control.protected voidcheckPassword(LdaptiveTemplate ldaptiveTemplate, LdaptiveUserDetails user, String password) Check password.protected LdaptiveTemplategetLdapTemplate(String username, String password) Gets ldap template.protected StringgetName(org.springframework.security.core.Authentication authentication) Gets name.protected LdaptiveUserDetailsgetUserDetails(LdaptiveTemplate ldaptiveTemplate, String username) Gets user details.Gets user details service.protected LdaptiveUserDetailsServicegetUserDetailsService(LdaptiveTemplate ldaptiveTemplate) Gets user details service.voidinit()Init.protected booleanisRefusedUsername(String username) Determines whether the username is refused by configuration.protected booleanrememberMeKeyMatches(org.springframework.security.authentication.RememberMeAuthenticationToken authentication) Remember me key matches given authentication.voidsetAccountControlEvaluator(AccountControlEvaluator accountControlEvaluator) Sets account control evaluator.voidsetEmailToUsernameResolver(EmailToUsernameResolver emailToUsernameResolver) Sets email to username resolver.voidsetMessageSource(org.springframework.context.MessageSource messageSource) voidsetUsernameToBindDnConverter(UsernameToBindDnConverter usernameToBindDnConverter) Sets username to bind dn converter.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(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
-
setEmailToUsernameResolver
Sets email to username resolver.- Parameters:
emailToUsernameResolver- the email to username resolver
-
setUsernameToBindDnConverter
Sets username to bind dn converter.- Parameters:
usernameToBindDnConverter- the username to bind dn converter
-
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 LdaptiveAuthentication 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
-
isRefusedUsername
Determines whether the username is refused by configuration.- Parameters:
username- the username- Returns:
trueif the username is refused, otherwisefalse
-
getName
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
Gets ldap template.- Parameters:
username- the usernamepassword- the password- Returns:
- the ldap template
-
getUserDetails
Gets user details.- Parameters:
ldaptiveTemplate- the ldaptive templateusername- the username- Returns:
- the user details
-
getUserDetailsService
Gets user details service.- Returns:
- the user details service
-
getUserDetailsService
Gets user details service.- Parameters:
ldaptiveTemplate- the ldaptive template- Returns:
- the user details service
-
checkPassword
protected void checkPassword(LdaptiveTemplate ldaptiveTemplate, LdaptiveUserDetails user, String password) Check password.- Parameters:
ldaptiveTemplate- the ldaptive templateuser- the userpassword- the password
-
checkAccountControl
Check account control.- Parameters:
user- the user
-