2010-11-17 5 views
0

J'ai rencontré un problème lors de la tentative d'authentification à partir de mes services Web. Voici le code qui échoue.AuthenticationNotSupportedException: DIGEST-MD5 sur WebSphere

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; 
    } 

Ce code fonctionne sur Active Directory sur AIX à l'aide d'IBM JVM 1.5, mais pas sur la même machine avec la même machine virtuelle lorsqu'il est exécuté dans WebSphere 6.1.

J'ai essayé de contrôler toutes les variables, et jusqu'à présent, il semble que WebSphere empêche l'authentification LDAP DIGEST-MD5. Des idées pourquoi?

Voici la trace de la pile:

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) 

Répondre

2

Alors que d'autres peuvent bénéficier de cette: modifier le fichier: /opt/IBM/WebSphere/AppServer/java/jre/lib/security/java.security faire une recherche pour security.provider et ajouter une ligne au bas des autres fournisseurs (si ce n'est pas déjà là): security.provider.X = com.ibm.security.sasl.IBMSASL (où X est le suivant numéro en séquence pour les lignes ci-dessus)

Nous avons eu ce même problème, même ouvert un PMR avec IBM (qui ne l'a pas encore savoir comment résoudre)

La réponse est venue en fait de leur propre lien: http://www.ibm.com/developerworks/java/jdk/security/50/secguides/saslDocs/ibm.sasl.provider.guide.html

semble que ce soit censé être « sur » par défaut ...

+0

Merci Steve H! J'ai été capable de reproduire et le correctif avec ces étapes précises. – johnwalker00