Skip to main content

Custom JNDI

No replies
paulolambert
Offline
Joined: 2012-02-25
Points: 0

Dear Members,

I try to create a custom-resource to be able to connect to a LDAP.

In GF3.1.2.2 Web admin, I create a custom-resource called jndi/ldap
resourceType=javax.naming.directory.Directory
factory-class=com.sun.jndi.ldap.LdapCtxFactory

I add the following properties:
SECURITY_AUTHENTICATION=simple
SECURITY_PRINCIPAL=myldapuser
SECURITY_CREDENTIALS=myldappassword
URL=ldap://myldap:3268

then in my managedBean, i do the following:
i have a method that connects to the ldap. I first create the DirContext

Context initCtx = new InitialContext();
DirContext ctx = (DirContext) initCtx.lookup("jndi/ldap");

When I debug, I see that theenvProp of ctx only contains the URL property all others are not loaded.

Do I miss someting ?

Thanks for your help.