Typically, we configure a vanilla LdapAuthenticationProvider with a Dn and a password.
auth
.ldapAuthentication()
.contextSource()
.url(env.getProperty("spring.ldap.urls") + "/" + env.getProperty("spring.ldap.base"))
.managerDn(env.getProperty("ldap.managerDn") + "," + env.getProperty("spring.ldap.base"))
.managerPassword(env.getProperty("spring.ldap.password"))
How should I go about achieving a similar configuration with ActiveDirectoryLdapAuthenticationProvider ?
Snippet of my current progress:
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider("domain.org",
"ldap://activedirectory-url:389");
adProvider.setConvertSubErrorCodesToExceptions(true);
adProvider.setUseAuthenticationRequestCredentials(true);
auth.authenticationProvider(adProvider);
}
}
I'm scratching my head about how to implement the same functionality with ActiveDirectoryLdapAuthenticationProvider. I have searched high and low but I'm at a loss on how to replicate the previous configuration with the Active Directory.