AuthenticationNotSupportedException:DIGEST-MD5在WebSphere上
我在尝试从web服务中进行身份验证时遇到问题。下面是失败的代码AuthenticationNotSupportedException:DIGEST-MD5在WebSphere上,authentication,ldap,websphere,md5,Authentication,Ldap,Websphere,Md5,我在尝试从web服务中进行身份验证时遇到问题。下面是失败的代码 private InitialDirContext callDirectory(String password, String usernameWithoutDomain) throws NamingException { InitialDirContext ctx; Hashtable<String, String> env = new Hashtabl
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;
}
private InitialDirContext callDirectory(字符串密码,
字符串usernameWithoutDomain)引发NamingException
{
InitialDirContext-ctx;
Hashtable env=新的Hashtable();
put(Context.INITIAL\u Context\u工厂,“com.sun.jndi.ldap.LdapCtxFactory”);
env.put(Context.PROVIDER\u URL,\u ldapUrl);
环境put(Context.SECURITY_认证,“摘要-MD5”);
环境put(Context.SECURITY\u主体,用户名不带域);
环境放置(Context.SECURITY\u凭证、密码);
ctx=新的初始目录上下文(env);
返回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)
javax.naming.AuthenticationNotSupportedException:DIGEST-MD5
位于com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:115)
位于com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:229)
位于com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652)
在com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:298)
位于com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:190)
位于com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:208)
位于com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:151)
位于com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:81)
位于javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:679)
位于javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:259)
位于javax.naming.InitialContext.init(InitialContext.java:235)
位于javax.naming.InitialContext。(InitialContext.java:209)
位于security.ActiveDirectoryReader.openDirectoryContext(ActiveDirectoryReader.java:80)
以便其他人可以从中受益:
修改文件:/opt/IBM/WebSphere/AppServer/java/jre/lib/security/java.security
搜索security.provider,并在其他提供程序的底部添加一行(如果尚未在其中):
security.provider.X=com.ibm.security.sasl.IBMSASL(其中X是其上方各行的下一个数字)
我们也遇到了同样的问题,甚至与IBM建立了PMR(IBM仍然不知道如何修复)
答案实际上来自他们自己的链接:
似乎默认情况下应该是“打开”的…谢谢Steve H!我能够用这些精确的步骤复制和修复。