Friday, August 27, 2010

Friday.. I am Home

Wake up at 8:30 am on any working day is an impossible task whn u need to commute all the way to my office in Gurgoan. It’s generally takes 1:30 hours from my place Ashok Vihar to GGN. With the growing infrastructure, we were expecting roads will be able to accommodate the heavy traffic but jst opposite happening. With infrastructure growing, Vehicle manufacturing companies are making good profit with Bajaj going with more then 125% growth and Car Manufacturing companies going at an avg. of > 35-40% growth.


May be Metro will give some relieve to the daily commuters and will un-burdened atleast some of the roads in GGN-Delhi. Lets wait for First week of September when metro is expected to hit Delhi to GGN in expected 75-80mins with close to 30 stations in between.

Authenticating to the LDAP by Using the JNDI

In the JNDI, authentication information is specified in environment properties. When you create an initial context by using the InitialDirContext class (or its superclass or subclass), you supply a set of environment properties, some of which might contain authentication information. You can use the following environment properties to specify the authentication information.


• Context.SECURITY_AUTHENTICATION ("java.naming.security.authentication").
Specifies the authentication mechanism to use. For the Sun LDAP service provider, this can be one of the following strings: "none", "simple", sasl_mech, where sasl_mech is a space-separated list of SASL mechanism names. See the next section for a description of these strings.

• Context.SECURITY_PRINCIPAL ("java.naming.security.principal").
Specifies the name of the user/program doing the authentication and depends on the value of the Context.SECURITY_AUTHENTICATION property. See the next few sections in this lesson for details and examples.

• Context.SECURITY_CREDENTIALS ("java.naming.security.credentials").
Specifies the credentials of the user/program doing the authentication and depends on the value of the Context.SECURITY_AUTHENTICATION property. See the next few sections in this lesson for details and examples.

When the initial context is created, the underlying LDAP service provider extracts the authentication information from these environment properties and uses the LDAP "bind" operation to pass them to the server. The following example(refer Simple.java) shows how, by using a simple clear-text password, a client authenticates to an LDAP server.

// 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");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=S. User, ou=NewHires, o=JNDITutorial");
env.put(Context.SECURITY_CREDENTIALS, "mysecret");
// Create the initial context
DirContext ctx = new InitialDirContext(env);
// ... do something useful with ctx

Thursday, August 26, 2010

Its thursday night !!!

I had my dinner, was playing with my niece whn i got a call on my cell. A number was blinking on my cell, phone was silent. It was my friend Deepak, he lives in the next building of the same society. The first thought caught my mind was "Why he is callng me this time? Hope everything fine?". With the perplex mind and thought running all way in my mind, I took the call. He Said "Bhai, where r u ?". I said with all my focus on him "I am home, wat happened?". He said come home smthing urgent. I said "Ok.. i m coming. Everything fine?". Ya..he replied. I wore my sleepers and rushed to his house, with various things running in my head. I was standing under his apartments when he came with his three others friends and said "We are short of one guy to pick this iron trunk to my home." I said crap "You would have told me this thing.??". He strangly replied, "I thought i should give you a surprise". To this I replied "Ya u surprised me." :P