org.entityfs.security
Interface Subject

All Superinterfaces:
Serializable
All Known Subinterfaces:
UidGidSubject
All Known Implementing Classes:
AbstractAccessControllerSubject, AbstractAccessControllerUidGidSubject, SimpleAccessControllerSubject, SimpleAccessControllerUidGidSubject

public interface Subject
extends Serializable

This is EntityFS take on JAAS' Subject class.

Since:
1.0
Author:
Karl Gustafsson

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.
 Set<Principal> getPrincipals()
          Get the set of JAAS Principal:s for this subject.
<T extends Principal>
Set<T>
getPrincipals(Class<T> c)
          Get a set of Principal:s for this subject that are instances or subclasses of the given class.
 Set<Object> getPrivateCredentials()
          Return the set of private credentials held by this subject.
<T> Set<T>
getPrivateCredentials(Class<T> c)
          Return a set of private credentials for this subject where the credentials are instances or subclasses of the given class.
 Set<Object> getPublicCredentials()
          Return the set of public credentials held by this subject.
<T> Set<T>
getPublicCredentials(Class<T> c)
          Return a set of public credentials for this subject where the credentials are instances or subclasses of the given class.
 

Method Detail

doAs

<T> T doAs(PrivilegedAction<T> action)
Perform the action as this subject.

Parameters:
action - The action to perform.
Returns:
The action's return value.

doAs

<T> T doAs(PrivilegedExceptionAction<T> action)
       throws Exception
Perform the action as this subject.

Parameters:
action - The action to perform.
Returns:
The action's return value.
Throws:
Exception - Any exception thrown from the action.

getPrincipals

Set<Principal> getPrincipals()
Get the set of JAAS Principal:s for this subject.

Returns:
The principals for this subject.

getPrincipals

<T extends Principal> Set<T> getPrincipals(Class<T> c)
Get a set of Principal:s for this subject that are instances or subclasses of the given class.

Parameters:
c - The class
Returns:
A set of principals.

getPrivateCredentials

Set<Object> getPrivateCredentials()
Return the set of private credentials held by this subject.

Returns:
The set of private credentials.

getPrivateCredentials

<T> Set<T> getPrivateCredentials(Class<T> c)
Return a set of private credentials for this subject where the credentials are instances or subclasses of the given class.

Parameters:
c - The credential class.
Returns:
A set of private credentials.

getPublicCredentials

Set<Object> getPublicCredentials()
Return the set of public credentials held by this subject.

Returns:
The set of public credentials.

getPublicCredentials

<T> Set<T> getPublicCredentials(Class<T> c)
Return a set of public credentials for this subject where the credentials are instances or subclasses of the given class.

Parameters:
c - The credential class.
Returns:
A set of public credentials.