org.entityfs.security
Class AbstractAccessControllerSubject

java.lang.Object
  extended by org.entityfs.security.AbstractAccessControllerSubject
All Implemented Interfaces:
Serializable, Subject
Direct Known Subclasses:
AbstractAccessControllerUidGidSubject, SimpleAccessControllerSubject

public abstract class AbstractAccessControllerSubject
extends Object
implements Subject

This abstract class can be used as a starting point for Subject implementations that use an AccessController. It implements the doAs methods.

Since:
1.0
Author:
Karl Gustafsson
See Also:
Serialized Form

Constructor Summary
protected AbstractAccessControllerSubject(AccessController ac)
           
 
Method Summary
<T> T
doAs(PrivilegedAction<T> action)
          Perform the action as this subject.
<T> T
doAs(PrivilegedExceptionAction<T> action)
          Perform the action as this subject.
protected
<T> Set<T>
getSubset(Set<?> s, Class<T> c)
          Get a set containing the elements in s that are instances or subclasses of the specified Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.entityfs.security.Subject
getPrincipals, getPrincipals, getPrivateCredentials, getPrivateCredentials, getPublicCredentials, getPublicCredentials
 

Constructor Detail

AbstractAccessControllerSubject

protected AbstractAccessControllerSubject(AccessController ac)
Method Detail

getSubset

protected <T> Set<T> getSubset(Set<?> s,
                               Class<T> c)
Get a set containing the elements in s that are instances or subclasses of the specified Class.

Type Parameters:
T - The type of the class.
Parameters:
s - The set
c - The class object.
Returns:
The subset of elements in s that are instances or subclasses of T.

doAs

public <T> T doAs(PrivilegedAction<T> action)
Description copied from interface: Subject
Perform the action as this subject.

Specified by:
doAs in interface Subject
Parameters:
action - The action to perform.
Returns:
The action's return value.

doAs

public <T> T doAs(PrivilegedExceptionAction<T> action)
       throws Exception
Description copied from interface: Subject
Perform the action as this subject.

Specified by:
doAs in interface Subject
Parameters:
action - The action to perform.
Returns:
The action's return value.
Throws:
Exception - Any exception thrown from the action.