aspose file tools
The moose likes Security and the fly likes JAAS Error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Security
Reply Bookmark "JAAS Error" Watch "JAAS Error" New topic
Author

JAAS Error

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 383
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: 35237
    
    7
Your post seems to contain the answer to your question already: the user running the application needs to have the "AuthPermission createLoginContext.chp02" permission.


Android appsImageJ pluginsJava web charts
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 383
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: 35237
    
    7
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAAS Error
 
Similar Threads
Implementing custom Realm to inject user Principals
java.security.AccessControlException
JAAS1.0 sample Error
Problem of JAAS with JDK version
What's wrong with this policy file???