I am getting a StringIndexOutOfBoundsException
javax.security.auth.login.LoginException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1444)
at java.lang.String.substring(String.java:1411)
at com.sun.security.auth.module.JndiLoginModule.attemptAuthentication(JndiLoginModule.java:5
36)
...
and that line of code where the exception happens is as follows (indicated with a <- symbol )
Attribute pwd = attributes.get(USER_PWD);
String encryptedPwd = new String((byte[])pwd.get(), "UTF8");
encryptedPassword = encryptedPwd.substring(CRYPT.length()); <---
I used a Java LDAP browser to check it out and for the LDAP url ldap://192.168.0.101/ou=customer,o=abcbank,dc=book,dc=com I got uid, userPassword etc - No Problem...
The LDAP server that I am using is openLDAP and it is running on Redhat Linux 9.0. The client is running on JDK1.4 on Win XP.
What is going on? This has been driving me nuts for over couple of hours now! Gurus throw some light please!
Many thanks, Vish Krishnan