Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAAS - two LoginModules - Getting a SecurityException : Help Needed

 
Anju Nadendla
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 4588
302
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"True JavaGuy" please check your private messages regarding an important administrative matter.
 
Anju Nadendla
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easy..I got it..Nothing needs to be changed in the config file.
I goofed up something in my code itself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic