Friday, December 25, 2009

JNDI Environment Properties

JNDI Environment Properties

JNDI provides place to specify various configuration details. There are different types of environment properties and defined in four clauses.


Standard JNDI environment properties
- defined by JNDI and common in all the service providers
  • java.naming.provider.url - URL, where the service provider deployed
  • java.naming.factory.initial - Initial Context implemented Class
  • java.naming.dns.url - URL, DNS host and domain names to use for the "jndi" URL context implementation
  • java.naming.factory.object
  • java.naming.factory.state
  • java.naming.factory.control
  • java.naming.factory.url.pkgs
Service-Specific Environment Properties
Common across all the service providers. Properties have the prefix java.naming.service. . For instance, java.naming.ldap.
Feature-Specific Environment Properties
Common across all the service providers for particular feature. Properties have the prefix java.naming.feature. . For instance, java.naming.sasl.
  • java.naming.security.principal - username
  • java.naming.security.credentials - password (if keystore configured then key will be placed here instead of password)
Provider-Specific Environment Properties
Specific to service provider. For instance, LDAP trace property com.sun.jndi.ldap.trace.ber, GSS-API and kerberos properties java.security.auth.login.config=gsseg_jaas.conf java.security.krb5.conf=krb5.conf

Some useful links Tutorial,TechnotessSecurity/Permission in client



Sample code to get context from LDAP


Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, 
    "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:7009/o=Oracle");

Context ctx = new InitialContext(env);

No comments:

Post a Comment

Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com