View RSS Feed


Using jndi in user authentication

Rate this Entry
by , 07-07-2012 at 04:28 PM (774 Views)
JNDI is used as naming service. It is commonly used to give security mechanism to make users authenticated to access the system resources. Credentials and user information is stored in directory services as entries. It is worthy to point it out that security model is not defined by JNDI however security model is used which has been defined in directory service.

Default initialContext is involved in creation of new Context that is in use of anonymous clients.
Java Code:
// Connect to the default naming server as a default user
Context ctx = new InitialContext();
When a user is authenticated, ID as well as Password shall combine and pass being a parameter, to InitialContext. When password doesn’t match, javax.naming.NoPermission would be get thrown towards clients. How a user could be authenticated has been given below, along with JNDI server “Weblogic default”.

Java Code:
// Set up the environment properties for the user
Properties prop = new Properties();
// Login use both user id, and password passed as Strings
prop.put(Context. SECURITY_PRINCIPAL, "Laura");
prop.put(Context. SECURITY_CREDENTIALS, "whiskers");

Submit "Using jndi in user authentication" to Facebook Submit "Using jndi in user authentication" to Digg Submit "Using jndi in user authentication" to Submit "Using jndi in user authentication" to StumbleUpon Submit "Using jndi in user authentication" to Google