Just finished testing your classes using my 1.3.1 development code and both your way and my way work, as it should. I don't get why using the permission instead of the permission name does not work for you.
I did however just think of 1 caveat in using the permission name instead of the permission. This might not be relevant for you (since you have a very small policy file), but if anybody else is following this thread it might be relevant to them. If your policy file contains a principal "foo" with action "render" for principal "p1" and a permission "foo" with action "enable" for principal "p2" your hive will return both principals p1 and p2 eventhough you did hive.getPrincipals(new ...Permission("foo","enable"). In this scenario it should only return p2 and not p1. Maurice On Feb 16, 2008 1:53 PM, Maurice Marrink <[EMAIL PROTECTED]> wrote: > On Feb 15, 2008 6:38 PM, Warren <[EMAIL PROTECTED]> wrote: > > Maurice, > > > > Here is my SimpleCachingHive and my Principal. I did not extend Permissin, I > > didn't think I had to. I pretty much based my implementation on you tabs > > example minus the tabs. Should I extend Permission and override hashCode() > > and equals(Object obj). And if I do, how do I force my hive to use my > > extended Permission? > > No you don't have to extend permission, it is optional. You could for > example create a ResourcePermission to check for permissions on file > uploads or downloads. For example: > permission org.ResourcePermission "/*.*", "read, write"; //enables > write permission on the root and every subdir > Your hive would not have to have explicit knowledge of this new > permission, it is sufficient if you declare it in your policy file and > in an ISecurityCheck do something like SwarmStrategy.hasPermission(new > ResourcePermission("/somefile.file")); > > Anyway moving away from this theoretical exercise and to your problem. > Your principal looks fine, if i have some time I'll try and run it myself. > One small difference i noticed (which should have no impact at all) is > you also use the class to generate the hash and in my simpleprincipal > i don't. But like i said this should not matter at all. > > Maurice > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]