@ -31,6 +31,7 @@ DigestAuthenticationFilter.usernameNotFound=Username {0} not found
@@ -31,6 +31,7 @@ DigestAuthenticationFilter.usernameNotFound=Username {0} not found
JdbcDaoImpl.noAuthority=User {0} has no GrantedAuthority
@ -142,12 +144,15 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@@ -142,12 +144,15 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
UsernamePasswordAuthenticationTokenauth){
Stringusername=auth.getName();
Stringpassword=(String)auth.getCredentials();
DirContextctx=bindAsUser(username,password);
DirContextctx=null;
try{
ctx=bindAsUser(username,password);
returnsearchForUser(ctx,username);
}
catch(CommunicationExceptione){
throwbadLdapConnection(e);
}
catch(NamingExceptione){
logger.error("Failed to locate directory entry for authenticated user: "
+username,e);
@ -210,8 +215,7 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@@ -210,8 +215,7 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
||(einstanceofOperationNotSupportedException)){
handleBindException(bindPrincipal,e);
throwbadCredentials(e);
}
else{
}else{
throwLdapUtils.convertLdapException(e);
}
}
@ -313,6 +317,12 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@@ -313,6 +317,12 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@ -327,6 +337,9 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@@ -327,6 +337,9 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends
@ -378,17 +382,29 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
@@ -378,17 +382,29 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
@ -414,8 +430,11 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
@@ -414,8 +430,11 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
provider.authenticate(joe);
fail("CommunicationException was expected with a root cause of ClassNotFoundException");