org.entityfs.security
Class SimpleAccessControllerSubject

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

public class SimpleAccessControllerSubject
extends AbstractAccessControllerSubject

This is a simple, immutable Subject implementation that uses an AccessController and a fixed list of credentials.

Since:
1.0
Author:
Karl Gustafsson
See Also:
Serialized Form
In_jar:
entityfs-core

Constructor Summary
SimpleAccessControllerSubject(AccessController ac)
          Create a Subject without any principals or credentials.
SimpleAccessControllerSubject(AccessController ac, Set<? extends Principal> principals, Set<?> privateCreds, Set<?> publicCreds)
          Create a Subject with the supplied set of principals and credentials.
 
Method Summary
 Set<Principal> getPrincipals()
          Get the Subject's principals.
<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.
 
Methods inherited from class org.entityfs.security.AbstractAccessControllerSubject
doAs, doAs, getSubset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAccessControllerSubject

public SimpleAccessControllerSubject(AccessController ac)
Create a Subject without any principals or credentials.

Parameters:
ac - The AccessController.

SimpleAccessControllerSubject

public SimpleAccessControllerSubject(AccessController ac,
                                     Set<? extends Principal> principals,
                                     Set<?> privateCreds,
                                     Set<?> publicCreds)
Create a Subject with the supplied set of principals and credentials.

Parameters:
ac - The AccessController
principals - The Subject's principals. May be null. The object stores a shallow copy of this set.
privateCreds - The Subject's private credentials. May be null. The object stores a shallow copy of this set.
publicCreds - The Subject's public credentials. May be null. The object stores a shallow copy of this set.
Method Detail

getPrincipals

public Set<Principal> getPrincipals()
Get the Subject's principals.

Returns:
A shallow copy of the Subject's set of principals.

getPrincipals

public <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

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

Returns:
The set of private credentials. (A shallow copy of the internal set.)

getPrivateCredentials

public <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

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

Returns:
The set of public credentials. (A shallow copy of the internal set.)

getPublicCredentials

public <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.