JBoss EAP 6.2 vs 6.3中的Spring Security 3.2.5和Active Directory

JBoss EAP 6.2 vs 6.3中的Spring Security 3.2.5和Active Directory,jboss,spring-security,active-directory,jboss-eap-6,Jboss,Spring Security,Active Directory,Jboss Eap 6,在我的应用程序中,我使用的是SpringSecurity 3.2.5。我正在尝试使用org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider通过ActiveDirectory进行身份验证。我正在测试一个密码错误的场景 在JBoss EAP 6.2中,我得到javax.naming.AuthenticationException,这是在ActiveDirectoryLd

在我的应用程序中,我使用的是SpringSecurity 3.2.5。我正在尝试使用org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider通过ActiveDirectory进行身份验证。我正在测试一个密码错误的场景

在JBoss EAP 6.2中,我得到javax.naming.AuthenticationException,这是在ActiveDirectoryLdapAuthenticationProvider中以Spring Security所期望的正确方式处理的。下面显示了Spring Security 3.2.5中ActiveDirectoryLdapAuthenticationProvider如何处理此异常:

try {
        return contextFactory.createContext(env);
    } catch (NamingException e) {
        if ((e instanceof AuthenticationException) || (e instanceof OperationNotSupportedException)) {
            handleBindException(bindPrincipal, e);
            throw badCredentials(e);
        } else {
            throw LdapUtils.convertLdapException(e);
        }
    }    
但是当我用JBoss EAP 6.3测试相同的场景时,我得到了javax.naming.NamingException,所以逻辑转到else语句。在LdapUtils.convertLdapException方法中,它返回

return new org.springframework.ldap.UncategorizedLdapException(ex);    
由于它不是一个AuthenticationException,所以它最终会变成错误500

由于Spring Security 3.2.5代码使用instanceof,而AuthenticationException是NamingException中的根本原因,您可以通过在调试时运行e.getCause看到这一点,因此ActiveDirectoryLdapAuthenticationProvider和LdapUtils中都不会处理该异常

我想在SpringSecurity或JBoss中修复这个问题都需要一些时间。我迫切需要一个解决办法。由于ActiveDirectoryLdapAuthenticationProvider是最后一个类,因此我无法基于它轻松创建自定义类。除了扩展AbstractLdapAuthenticationProvider并从ActiveDirectoryLdapAuthenticationProvider复制整个内容之外,还有其他想法吗


提前谢谢。

您能告诉我您是如何解决这个问题的吗?