问题
This is my frist question and its about the title error.
Context:
I should implement a Java EE (Spring boot app) with ActiveDirectory (windows) authentication. Just authentication, the authorization is not Active Directory based and is only a query method that search in a table for roles in boolean fields. I mean, is not role-based for authorization.
I follow (for starting my app) this guide : https://spring.io/guides/gs/authenticating-ldap/
Now its time to leave the embedded LDAP example and replace it for the true Active Directory validation.
I just follow a couple guide, but is not working!
Actually i returned to the Spring Tutorial form and define this -->
@Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests().antMatchers("**/css/**").permitAll().antMatchers("**/js/**").permitAll()
.antMatchers("**/img/**").permitAll().anyRequest().fullyAuthenticated().and().formLogin();
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/attendanceConfirmation/{attendanceId}");
}
@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
authManagerBuilder.authenticationProvider(activeDirectoryLdapAuthenticationProvider())
.userDetailsService(userDetailsService());
}
@Bean
public AuthenticationManager authenticationManager() {
return new ProviderManager(Arrays.asList(activeDirectoryLdapAuthenticationProvider()));
}
@Bean
public ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider = new ActiveDirectoryLdapAuthenticationProvider(
"domain.com", "ldap://bussinesName.com/");
activeDirectoryLdapAuthenticationProvider.setSearchFilter("(&(objectClass=user)(sAMAccountName={0}))");
activeDirectoryLdapAuthenticationProvider.setConvertSubErrorCodesToExceptions(true);
activeDirectoryLdapAuthenticationProvider.setUseAuthenticationRequestCredentials(true);
return activeDirectoryLdapAuthenticationProvider;
}
}
Where the domain is this form -> companyName.com and the ldap url is about this form : ldap://companyName.com/ (aditionally i try with this form of ldap url=> LDAP://companyName.com/DC=ar,DC=companyName,DC=com but it doesnt work.
I dont know if I should implement more services or methods I really take this form (after develop the app working with Spring Guide) from Internet.
Really thank you guys, and sorry for my english.
Greetings from Argentina!
来源:https://stackoverflow.com/questions/63016796/ldap-springsecurityldaptemplate-ignoring-partialresultexception