Sistema de Nombrado en Java (JNDI) y II

Como hemos visto, el mecanismo de autentificaci�n por defecto es "none" si no se configuran propiedades de entorno de autentificaci�n. Si el cliente configura la propiedad de entorno Context.SECURITY_AUTHENTICATION a "none", entonces el mecanismo de autentificaci�n es "none" y se ignoran todas las dem�s propiedades de entorno. Podr�amos querer hacer esto expl�citamente s�lo para asegurarnos que se ignora cualquier otra que podr�a haber sido configurada. En cualquier caso, el cliente ser� tratado como un cliente an�nimo. Esto significa que el servidor no conoce conoce ni le importa qui�n es el cliente y permitira al cliente acceder (leer y atualizar) cualquier dato que haya sido configurado para ser accesible para cualquier cliente autentificado.

Como ninguno de los ejemplos del directorio en la secci�n Lo B�sico configura ninguna propiedad de entorno de autentifiaci�n, todos ellos usan autentificaci�n an�nima.

Aqu� hay un ejemplo que expl�citamente configura la propiedad Context.SECURITY_AUTHENTICATION a "none" (incluso aunque hacer esto no es estrictamente porque es el valor por defecto.

// Set up the environment for creating the initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");

// Use anonymous authentication
env.put(Context.SECURITY_AUTHENTICATION, "none");

// Create the initial context
DirContext ctx = new InitialDirContext(env);

// ... do something useful with ctx

COMPARTE ESTE ARTÍCULO

COMPARTIR EN FACEBOOK
COMPARTIR EN TWITTER
COMPARTIR EN LINKEDIN
COMPARTIR EN WHATSAPP
ARTÍCULO ANTERIOR