Hi, I am trying to use the authentication method from 1.3
I tried the same sample posted from the blog "http://blog.jayway.com/2008/10/27/whats-new-in-spring-ldap-13/"
Here is my code.
Here is the log output.Code:public boolean authenticate(String userName, String password) { boolean result = false; EqualsFilter filter = new EqualsFilter("uid", userName); // Actual filter will differ depending on LDAP Server and schema List<String> results = ldapTemplate.search("", filter.toString(), new DnContextMapper()); if (results.size() != 1) { throw new IncorrectResultSizeDataAccessException(1, results.size()); } DirContext ctx = null; try { String uid = results.get(0); logger.debug("Getting context source with principal :"+uid); ctx = contextSource.getContext(uid, password); result= true; }catch (Exception e) { logger.error("Exception occured :"+e.getMessage()); logger.trace(e); } finally { LdapUtils.closeContext(ctx); } return result; }
I have verified the credentials for the user [maven_proxy_account] externally and that seems to work fine.Code:[11-11-08:15:51:25- (DEBUG)] com.edu.dao.SpringAuthenticationDAO : Getting context source with principal :cn=maven_proxy_account,o=The XXX Companies [11-11-08:15:51:25- (ERROR)] com.edu.dao.SpringAuthenticationDAO : Exception occured :[LDAP: error code 32 - No Such Object]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 32 - No Such Object]
I notice that DN formation happens properly hence when i supply uid to this function it gets resolved to [cn=maven_proxy_account,o=The XXX Companies]
Any help appreciated.
Thanks
Vignesh


Reply With Quote