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 Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "JAAS Error" Watch "JAAS Error" New topic
Author

JAAS Error

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
Hi,

I created a sample JAAS application. When I execute the code I get
Exception in thread "main" java.security.AccessControlException: access denied (javax.security.auth.AuthPermission createLoginContext.chp02) error

I get this error when I call logincontextobject.Login();

Policy File:
grant Principal chp02.UserPrincipal "user"
{
// not granted anything
};
grant Principal chp02.SysAdminPrincipal "sysadmin"
{
permission java.io.FilePermission "conf/chp02.policy", "read";
};

Configuration File

chp02
{
chp02.auth.SimpleLoginModule REQUIRED;
};

Can someone help

Thanks
Shashank


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Your post seems to contain the answer to your question already: the user running the application needs to have the "AuthPermission createLoginContext.chp02" permission.
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
how do I give him the permission. I am using JAAS for the first time. I am doing a tutorial, which has not mentioned anything about this permission

javax.security.auth.AuthPermission

thanks

shashank
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Probably by adding a line like



to the "user" and "sysadmin" entries in the policy file. Once that works, other permissions may also be needed; have a look at the javadocs of the AuthPermission class for more detail.
 
wood burning stoves
 
subject: JAAS Error