geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjay kumar <>
Subject [No Subject]
Date Mon, 03 Jan 2011 07:31:28 GMT
   I am calling a realm by its name and passing the user name and password
as principal and credentials. In the initializer method of login module of
realm I am getting the username and password. But password is in encrypted
form. I need the password to be in decrypted form. My code is given below
about how I am passing the username and password and how I am getting them:

Test client code:(only some portion, not full)

Properties props = new Properties();


            props.put("java.naming.provider.url", "");
            props.put("", "sanjay");
            props.put("", "test");

the login module code in which I get the username and password:

Callback[] callbacks = new Callback[2];
        callbacks[0] = new NameCallback("username: ");
        callbacks[1] = new PasswordCallback("password: ", false);

        username = ((NameCallback)callbacks[0]).getName();
// This line prints the username as specified above code as principal. i.e
        if(username == null)
        throw new LoginException("No user specified");

        char[] tmpPassword =((PasswordCallback)callbacks[1]).getPassword();
//This line prints the password but in encrypted form. its something like
this :[C@57a3ec8d. I need this to be as it is in credentials in test code
i.e it should print "test".
            if (tmpPassword == null)
            // treat null password as an empty password
            tmpPassword = new char[0];


I am using Geronimo 2.2. Any suggestions?

Sanjay Kumar
Java Developer

View raw message