I want to know if the LDAP application will really use userDn / password, which I collect at runtime during authentication.
http://static.springsource.org/spring-security/site/docs/3.0.x/reference/ldap.html
It will use the userDn and password that you collect at runtime. Based on how you configure your beans, LDAP authentication will use one of two paths in Spring:
BindAuthenticator Authentication (using BindAuthenticator )- Password comparison (using
PasswordComparisonAuthenticator )
These authenticators are called in the context of the LdapAuthenticationProvider , which can be configured as an authenticator in the security namespace configuration:
<authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="usernamePasswordUserDetailsService"> <password-encoder ref="passwordEncoder"> <salt-source ref="saltSource"/> </password-encoder> </authentication-provider> <authentication-provider ref="ldapAuthenticationProvider"/> </authentication-manager>
When calling UsernamePasswordAuthenticationFilter (via the / auth / login page):
<http auto-config="true"> <form-login login-page="/auth/login" login-processing-url="/auth/j_security_check"/> <logout invalidate-session="true" logout-url="/auth/logout"/> </http>
a token is created with a username and password. LdapAuthenticationProvider responds to this token:
public class LdapAuthenticationProvider implements AuthenticationProvider, MessageSourceAware { ... public boolean supports(Class<?> authentication) { return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication)); } }
And use the information you saved in LdapContextSource to perform authentication.
source share