org.freshcookies.security.policy
Class LocalPolicy.LocalProtectionDomain

java.lang.Object
  extended by org.freshcookies.security.policy.LocalPolicy.LocalProtectionDomain
Enclosing class:
LocalPolicy

public static class LocalPolicy.LocalProtectionDomain
extends java.lang.Object

Lightweight re-implementation of ProtectionDomain that does not allow subsequent modifications to Permissions. The default ProtectionDomain is, unfortunately, unsuitable for use with LocalPolicy because default JVM permissions are added "dynamically" subsequent to creation. This class exhibits the same basic behaviors as ProtectionDomain: null values are allowed for the LocalProtectionDomain's Principals, CodeSource and PermissionCollection. Also, if the Principal array supplied is null, it will be converted to a zero-length array.


Constructor Summary
LocalPolicy.LocalProtectionDomain(java.security.CodeSource codesource, java.security.PermissionCollection permissions, java.lang.ClassLoader classloader, java.security.Principal[] principals)
          Constructs a new LocalProtectionDomain.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader used to construct the LocalProtectionDomain, which may be null.
 java.security.CodeSource getCodeSource()
          Returns the CodeSource used to construct the LocalProtectionDomain, which may be null.
 java.security.PermissionCollection getPermissions()
          Returns the PermissionCollection used to construct the LocalProtectionDomain, which may be null.
 java.security.Principal[] getPrincipals()
          Returns the Principal array used to construct the LocalProtectionDomain, if supplied, or a zero-length array if not supplied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalPolicy.LocalProtectionDomain

public LocalPolicy.LocalProtectionDomain(java.security.CodeSource codesource,
                                         java.security.PermissionCollection permissions,
                                         java.lang.ClassLoader classloader,
                                         java.security.Principal[] principals)
Constructs a new LocalProtectionDomain.

Parameters:
codesource - the code source; may be null
permissions - the permission collection; may be null
principals - the principals to whom the permissions are granted; may be null
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the ClassLoader used to construct the LocalProtectionDomain, which may be null.

Returns:
the class loader

getCodeSource

public java.security.CodeSource getCodeSource()
Returns the CodeSource used to construct the LocalProtectionDomain, which may be null.

Returns:
the principals

getPermissions

public java.security.PermissionCollection getPermissions()
Returns the PermissionCollection used to construct the LocalProtectionDomain, which may be null.

Returns:
the permissions

getPrincipals

public java.security.Principal[] getPrincipals()
Returns the Principal array used to construct the LocalProtectionDomain, if supplied, or a zero-length array if not supplied.

Returns:
the principals