uk.ac.soton.itinnovation.grid.pbac2.pep
Class DynamicPEP<T>

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.pbac2.pep.DynamicPEP<T>
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
AxisDynamicPEP

public class DynamicPEP<T>
extends Object
implements InvocationHandler

This class creates a proxy object that wraps an object with a PEP. Calling a method on the proxy object will call PDP.lockAndCheck(java.lang.String, uk.ac.soton.itinnovation.grid.types.SubjectDescription, java.lang.String) first, then call the wrapped object's method, and then unlock the resource.

The action is the name of the method being invoked.


Field Summary
protected  T original
           
protected  String resource
           
protected  SubjectDescription subject
           
 
Constructor Summary
protected DynamicPEP(T impl, PDP pdp, String resource, SubjectDescription subject)
           
 
Method Summary
static
<T> T
dynamicPEP(Class<T> iface, T impl, PDP pdp, String resource, SubjectDescription subject)
          Create a proxy for 'iface', where all public methods are PEP-wrapped.
 Object invoke(Object proxy, Method method, Object[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

original

protected T original

resource

protected String resource

subject

protected SubjectDescription subject
Constructor Detail

DynamicPEP

protected DynamicPEP(T impl,
                     PDP pdp,
                     String resource,
                     SubjectDescription subject)
Method Detail

dynamicPEP

public static <T> T dynamicPEP(Class<T> iface,
                               T impl,
                               PDP pdp,
                               String resource,
                               SubjectDescription subject)
Create a proxy for 'iface', where all public methods are PEP-wrapped.

Parameters:
iface - the interface of the object to wrap
impl - an implementation of iface
pdp - the PDP to use for access control decisions
resource - the PBAC resource being protected, or null to use ProcessContextHelper#getProcessContext
subject - the user accessing the resource, or null to use AuthenticatedContextHelper#getCurrentUser
Returns:
an implementation of the interface that checks each access with the PDP

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.