Meaningless Drivel is fun!*
The moose likes Security and the fly likes JAAS - two LoginModules - Getting a SecurityException : Help Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Security
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: 5
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
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3060
    
  38

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


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Anju Nadendla
Greenhorn

Joined: Mar 17, 2010
Posts: 5
Easy..I got it..Nothing needs to be changed in the config file.
I goofed up something in my code itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAAS - two LoginModules - Getting a SecurityException : Help Needed