Forum Stats

  • 3,853,732 Users
  • 2,264,259 Discussions
  • 7,905,436 Comments

Discussions

Policy files

843811
843811 Member Posts: 49,851 Green Ribbon
Hello,

Anyone with experience with policy files?

I have this ibn a policy file. I load it using the property :
-Djava.security.auth.login.config=D:\pathh\...\raul_jaas.cfg

And in the policy file is:

grant Principal NTUserPrincipal "my_user_name"
{
permission com.mycomp.raul.RaulPermission "RaulPermissionName";
};

The access is denied all the time.
(Oh, I am using JAAS Nt modules for the LoginContext and Principals).

If I add:

permission com.mycomp.raul.RaulPermission "RaulPermissionName";

To the grant list of the java.policy then it works fine, I am allowed. But java.policy doesnt allow to include principals.


When I tried to get the permissions in the accessController, in the first case I dont get the perm, although if I make syntax errors in that policy file it complains "loudly".
In the second case, adding the permission to the java.policy it loads it like unresolved, but works fine after, when I call it.

Another solution that I didnt try yet, could be to create my own Policy implementation, that means use it instead sun.security.PolicyFile ( only one can survive ). I have to add my class, in this case, to the rt.jar or set the bootpath of the VM to the dir where it is.

Any help or comments?

Comments

This discussion has been closed.