【问题标题】:AuthenticationNotSupportedException: DIGEST-MD5 on WebSphereAuthenticationNotSupportedException:WebSphere 上的 DIGEST-MD5
【发布时间】:2011-05-11 17:12:09
【问题描述】:

我在尝试从我的 Web 服务中进行身份验证时遇到了问题。这是失败的代码。

private InitialDirContext callDirectory(String password,
            String usernameWithoutDomain) throws NamingException 
    {
        InitialDirContext ctx;
        Hashtable<String, String> env = new Hashtable<String, String>();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, _ldapUrl ); 
        env.put(Context.SECURITY_AUTHENTICATION, "DIGEST-MD5"); 
        env.put(Context.SECURITY_PRINCIPAL, usernameWithoutDomain ); 
        env.put(Context.SECURITY_CREDENTIALS, password);  
        ctx = new InitialDirContext(env);
        return ctx;
    }

此代码适用于使用 IBM 1.5 JVM 的 AIX 上的 Active Directory,但在 WebSphere 6.1 中运行时不适用于具有相同 VM 的同一台机器。

我尝试控制所有变量,到目前为止,WebSphere 似乎正在阻止 DIGEST-MD5 LDAP 身份验证。任何想法为什么?

这是堆栈跟踪:

javax.naming.AuthenticationNotSupportedException: DIGEST-MD5 
     at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:115) 
     at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:229) 
     at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652) 
     at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:298) 
     at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:190) 
     at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:208) 
     at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:151) 
     at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:81) 
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:679) 
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:259) 
     at javax.naming.InitialContext.init(InitialContext.java:235) 
     at javax.naming.InitialContext.<init>(InitialContext.java:209) 
     at security.ActiveDirectoryReader.openDirectoryContext(ActiveDirectoryReader.java:80)

【问题讨论】:

    标签: authentication ldap websphere md5


    【解决方案1】:

    以便其他人可以从中受益: 修改文件:/opt/IBM/WebSphere/AppServer/java/jre/lib/security/java.security 搜索 security.provider 并在其他提供者的底部添加一行(如果它还没有在那里): security.provider.X=com.ibm.security.sasl.IBMSASL(其中 X 是它上面的行的下一个数字)

    我们遇到了同样的问题,甚至与 IBM 开了一个 PMR(仍然不知道如何解决)

    答案其实来自他们自己的链接: http://www.ibm.com/developerworks/java/jdk/security/50/secguides/saslDocs/ibm.sasl.provider.guide.html

    似乎默认情况下应该是“开启”...

    【讨论】:

    • 感谢史蒂夫 H!我能够通过这些精确的步骤重现和修复。
    猜你喜欢
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 2014-05-28
    • 2011-01-17
    • 1970-01-01
    • 2017-02-26
    • 1970-01-01
    • 2016-03-18
    相关资源
    最近更新 更多