aspose file tools*
The moose likes Tomcat and the fly likes LDAP Authentication with Active Directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "LDAP Authentication with Active Directory" Watch "LDAP Authentication with Active Directory" New topic
Author

LDAP Authentication with Active Directory

Princeton Ebanks
Greenhorn

Joined: Mar 20, 2008
Posts: 5
I am using Netbeans and the Apache module that comes with it to build an intranet application that uses authentication with Active Directory. I have a few questions

1. Is the apache module that comes bundled with Netbeans configured to work with active directory for authentication?

2. How do I configure apache to use active directory for authentication

3. How do I configure the apache realm to use active directory for authentication through LDAP

I have tried with the code below, and the result is the java exception that follows. I have tried many options and several attributes for the realm configuration.

the code...

<Realm className="org.apache.catalina.realm.JNDIRealm"
debug="99"
connectionURL="ldap://<my_server_address>:389"
userRoleName="member"
userBase="cn=users,dc=<my_domain_name>"
userPattern="cn={0},cn=Users,dc=<my_domain_name>"
roleBase="cn=Users,dc=<my_domain_name>"
roleName="cn"
roleSearch="(member={0})"
roleSubtree="false"
userSubtree="true"

the exception...

javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece

at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3045)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2951)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2758)
at com.sun.jndi.ldap.LdapCtx.c_getAttributes(LdapCtx.java:1295)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:213)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109)
at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:123)
at org.apache.catalina.realm.JNDIRealm.getUserByPattern(JNDIRealm.java:1026)
at org.apache.catalina.realm.JNDIRealm.getUser(JNDIRealm.java:990)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:916)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:810)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


I need some insights into possible sources of this error
Heather Rose
Ranch Hand

Joined: Aug 25, 2008
Posts: 54
Obviously, you will need a bind for your connection. I am having the same problem, but after I bind, I get an IllegalArgumentException stating I can't bind a null object with no attributes.



Let me know if you find a solution for this problem. I have posted my error for your reference. Thank you.


java.lang.IllegalArgumentException: cannot bind null object with no attributes
at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
at javax.naming.InitialContext.bind(Unknown Source)
Oliver Baum
Greenhorn

Joined: Jan 12, 2005
Posts: 16
I think you need a connectionName and a connectionPassword to connect to the LDAP server
Heather Rose
Ranch Hand

Joined: Aug 25, 2008
Posts: 54
Look at My other post, if you are still intersted in connecting to active directory.
[ September 26, 2008: Message edited by: Heather Rose ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LDAP Authentication with Active Directory