File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes JAAS - two LoginModules - Getting a SecurityException : Help Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Security
Reply Bookmark "JAAS - two LoginModules - Getting a SecurityException : Help Needed" Watch "JAAS - two LoginModules - Getting a SecurityException : Help Needed" New topic
Author

JAAS - two LoginModules - Getting a SecurityException : Help Needed

Anju Nadendla
Greenhorn

Joined: Mar 17, 2010
Posts: 2
Hello,

I am trying a sample program with Client side JAAS Authentication.

With one login module my program works fine.

However,if I am trying to run the same test with two login modules namely,FirstLoginModule and SecondLoginModule.

My code works fine only when the secondLoginModule is set to "optional".

For all the other flags such as "Required","Requisite" I get the following exception.

javax.security.auth.login.LoginException: Security Exception
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:856)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:580)
at TestASAClient.main(TestASAClient.java:23)
Caused by: java.lang.SecurityException
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:857)
... 6 more
Cannot create LoginContext. Security Exception



My FirstLoginModules flags can be any.(Required/Requisite/Sufficient)



My config file is as follows.

/** Login Configuration for the JAAS Sample Application **/

testSample{
com.test.FirstLoginModule required debug=true;
com.test.SecondLoginModule required debug=true;
};


Appriciate your help in fixing this.

Thanks
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2586

"True JavaGuy" please check your private messages regarding an important administrative matter.


Author of ExamLab - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
Anju Nadendla
Greenhorn

Joined: Mar 17, 2010
Posts: 2
Easy..I got it..Nothing needs to be changed in the config file.
I goofed up something in my code itself.
 
 
subject: JAAS - two LoginModules - Getting a SecurityException : Help Needed
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com