This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Web Services and the fly likes Authenticate weblogic security realm user against LDAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Reply locked New topic

Authenticate weblogic security realm user against LDAP

Benjamin Ten

Joined: Dec 05, 2012
Posts: 3
I have installed weblogic '' and created a domain 'business' and created a user 'businessuser' in the default security realm 'myrealm'. The authenticator is a DefaultAuthenticator as in weblogic. Now, I want to authenticate the user in my standalone java application using LDAP. I have also tried changing the LDAP credentials. After executing the application, the system is responding with the following error: javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]. Is there any configuration to be done in weblogic that I am missing?

***** CODE-START *****

Properties l_props = new Properties();
LdapContext l_ctx = null;
l_props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
l_props.put(Context.PROVIDER_URL, "ldap://localhost:7001");
l_props.put(Context.SECURITY_AUTHENTICATION, "simple");
l_props.put(Context.SECURITY_PRINCIPAL, "cn=username");
l_props.put(Context.SECURITY_CREDENTIALS, "password");
l_ctx = new InitialLdapContext(l_props, null);

***** CODE-END *****


javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(
at com.sun.jndi.ldap.LdapCtx.processReturnCode(
at com.sun.jndi.ldap.LdapCtx.processReturnCode(
at com.sun.jndi.ldap.LdapCtx.connect(
at com.sun.jndi.ldap.LdapCtx.<init>(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.ldap.InitialLdapContext.<init>(
at com.iflex.fcat.misc.TestLDAP.createInitialLdapContext(
at com.iflex.fcat.misc.TestLDAP.authenticate(
at com.iflex.fcat.misc.TestLDAP.main(

***** EXCEPTION-END *****
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63547

Please do not post the same question more than once.

[Asking smart questions] [About Bear] [Books by Bear]
subject: Authenticate weblogic security realm user against LDAP
It's not a secret anymore!