net.sf.jguard.security
Class JGuardPolicy

java.lang.Object
  extended byjava.security.Policy
      extended bynet.sf.jguard.security.JGuardPolicy

public class JGuardPolicy
extends java.security.Policy

Jguard Policy implementation. note this policy is not tied to a Permission manager implementation, or a special permission class.

Author:
Charles Gay, Theo Niemeijer

Constructor Summary
JGuardPolicy()
          constructor.
 
Method Summary
 java.security.PermissionCollection getPermissions(java.security.CodeSource codesource)
          JGuard Policy act as a wrapper for this method.
 java.security.PermissionCollection getPermissions(java.security.ProtectionDomain protectionDomain)
          retrieve all user's permissions.
 void refresh()
          Deprecated.  
 void refresh(java.lang.ClassLoader cl)
          refresh all the permissions.
 PermissionProvider registerPermissionProvider(java.lang.ClassLoader cl, PermissionProvider pm)
          Register permission provider.
static void setPolicy(java.security.Policy policy)
          define the java Policy in use.
 void unregisterPermissionProvider(java.lang.ClassLoader cl)
          Unregister permission provider.
 
Methods inherited from class java.security.Policy
getPolicy, implies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGuardPolicy

public JGuardPolicy()
constructor.

Method Detail

refresh

public void refresh()
Deprecated.  

refresh all the permissions. if somes changes are made with the permissionManager implementation, this method must be called to reflect these changes. DUMMY implementation. you should use instead public void refresh(ClassLoader cl) JGuardPolicy method.

See Also:
refresh(ClassLoader cl)

refresh

public void refresh(java.lang.ClassLoader cl)
refresh all the permissions. if somes changes are made with the permissionManager implementation, this method must be called to reflect these changes.

Parameters:
cl - webapplication's classloader
See Also:
refresh()

setPolicy

public static void setPolicy(java.security.Policy policy)
define the java Policy in use. this method does not allow any code to replace the current jGuardPolicy in the jvm.

See Also:
Policy.setPolicy(java.security.Policy)

getPermissions

public java.security.PermissionCollection getPermissions(java.security.CodeSource codesource)
JGuard Policy act as a wrapper for this method. it delegates to default's Policy implementation defined in Jguard.policy file, this method.

Parameters:
codesource -
Returns:
all the permissions own by the CodeSource
See Also:
Policy.getPermissions(java.security.CodeSource)

getPermissions

public java.security.PermissionCollection getPermissions(java.security.ProtectionDomain protectionDomain)
retrieve all user's permissions. if this protectionDomain is protected by jGuard, we add the jGuard additional permissions to the permissionCollection obtained with the defaultPolicy implementation when the SecurityManager is set. otherwise, the only PermissionCollection created by jGuard is returned.

Parameters:
protectionDomain -
Returns:
permissions collection
See Also:
Policy.getPermissions(java.security.ProtectionDomain)

registerPermissionProvider

public PermissionProvider registerPermissionProvider(java.lang.ClassLoader cl,
                                                     PermissionProvider pm)
Register permission provider. Registers given permission provider instance with the specified classloader instance.

Parameters:
cl - - class loader value
pm - - permission provider
Returns:
permission provider value

unregisterPermissionProvider

public void unregisterPermissionProvider(java.lang.ClassLoader cl)
Unregister permission provider. Removes permission provider associated with the given classloader instance.

Parameters:
cl - - class loader
Returns:
permission provider value