This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Security and the fly likes  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "  " Watch "  " New topic

Vaibhav Tomorrow

Joined: Jun 30, 2008
Posts: 6
I am trying to perform authorization and using jaas.policy file.
Can any one suggest what is wrong with the policy file.
it is placed in the same folder where code exists.
jaas.policy file:
grant Principal UserPrincipal "TestUser" {
permission PersonnelPermission "access";
The Client code is :
LoginContext loginContext = new LoginContext("Userpass",new MyCallbackHandler());
Subject.doAsPrivileged(loginContext.getSubject(),new PersonnelAction(),null);

PersonnelAction implements PrivilegedAction.
I am trying to check the access permission but getting the following error: Access denied (test.PersonnelPermission access)
at test.Client.main(
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42359
How are you specifying the policy file to be used? In won't get used just by virtue of being in the same directory as your code.

Ping & DNS - my free Android networking tools app
Consider Paul's rocket mass heater.