Forum Stats

  • 3,780,791 Users
  • 2,254,438 Discussions


implied permissions

843811 Member Posts: 49,851
I have sub-classed, so that I can implement a permissions structure for my application. I would like to arrange things so that I can specify one or more blanket permissions for a Subject (this is JAAS) and have each blanket permission imply some set of specific permissions, something for which the Permission.implies(Permission p) method seems tailor-made. However, when I attempt:
  SecurityManager sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPermission(new MyPermission("a_named_action"));
I find that the implies() method I provided, is not being called. I am apparently misunderstanding the system here. Any help is appreciated.



  • 843811
    843811 Member Posts: 49,851
    Implies method is usually used when there is a wildcard take FilePermission.

    So for example

    permission FilePermission "c:\winnt\profiles\*" "read"

    This means that all files in the c:\winnt\profiles directory this person can read.

    So when the call to read the file c:\winnt\profiles\protected.txt. The code calls the AccessController.checkPermission( new FilePermission("c:\winnt\profiles\protected.txt") );

    Then since there is no match then implies is called to see if the granted permission implies the checked permission.

This discussion has been closed.