org.entityfs.entityattrs
Class SimpleAccessControllerUidGidSubject

java.lang.Object
  extended by org.entityfs.security.AbstractAccessControllerSubject
      extended by org.entityfs.security.SimpleAccessControllerSubject
          extended by org.entityfs.entityattrs.SimpleAccessControllerUidGidSubject
All Implemented Interfaces:
Serializable, UidGidSubject, Subject

public class SimpleAccessControllerUidGidSubject
extends SimpleAccessControllerSubject
implements UidGidSubject

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

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

Constructor Summary
SimpleAccessControllerUidGidSubject(AccessController ac, int uid, int gid)
          Create a UidGidSubject without any principals, credentials or secondary GID:s.
SimpleAccessControllerUidGidSubject(AccessController ac, int uid, int gid, Collection<Integer> secondaryGids)
          Create a UidGidSubject without any principals or credentials.
SimpleAccessControllerUidGidSubject(AccessController ac, Set<? extends Principal> principals, Set<?> privateCreds, Set<?> publicCreds, int uid, int gid, Collection<Integer> secondaryGids)
          Create a UidGidSubject with the supplied set of principals and credentials.
 
Method Summary
 int getPrimaryGid()
          Get the primary GID.
 Set<Integer> getSecondaryGids()
          Get the set of secondary GID:s.
 int getUid()
          Get the UID.
 
Methods inherited from class org.entityfs.security.SimpleAccessControllerSubject
getPrincipals, getPrincipals, getPrivateCredentials, getPrivateCredentials, getPublicCredentials, getPublicCredentials
 
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
 
Methods inherited from interface org.entityfs.security.Subject
doAs, doAs, getPrincipals, getPrincipals, getPrivateCredentials, getPrivateCredentials, getPublicCredentials, getPublicCredentials
 

Constructor Detail

SimpleAccessControllerUidGidSubject

public SimpleAccessControllerUidGidSubject(AccessController ac,
                                           int uid,
                                           int gid)
                                    throws IllegalArgumentException
Create a UidGidSubject without any principals, credentials or secondary GID:s.

Parameters:
ac - The access controller.
uid - The Subject's user id.
gid - The Subject's primary group id.
Throws:
IllegalArgumentException - If the user id or the primary group id is less than zero.

SimpleAccessControllerUidGidSubject

public SimpleAccessControllerUidGidSubject(AccessController ac,
                                           int uid,
                                           int gid,
                                           Collection<Integer> secondaryGids)
                                    throws IllegalArgumentException
Create a UidGidSubject without any principals or credentials.

Parameters:
ac - The access controller.
uid - The Subject's user id.
gid - The Subject's primary group id.
secondaryGids - The Subject's secondary group id:s.
Throws:
IllegalArgumentException - If any of the id:s is less than zero.

SimpleAccessControllerUidGidSubject

public SimpleAccessControllerUidGidSubject(AccessController ac,
                                           Set<? extends Principal> principals,
                                           Set<?> privateCreds,
                                           Set<?> publicCreds,
                                           int uid,
                                           int gid,
                                           Collection<Integer> secondaryGids)
                                    throws IllegalArgumentException
Create a UidGidSubject 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.
uid - The Subject's user id.
gid - The Subject's primary group id.
secondaryGids - The Subject's secondary group id:s.
Throws:
IllegalArgumentException - If the user id or the group id is less than zero.
Method Detail

getUid

public int getUid()
Description copied from interface: UidGidSubject
Get the UID.

Specified by:
getUid in interface UidGidSubject
Returns:
The UID (a positive integer).

getPrimaryGid

public int getPrimaryGid()
Description copied from interface: UidGidSubject
Get the primary GID.

Specified by:
getPrimaryGid in interface UidGidSubject
Returns:
The primary GID (a positive integer).

getSecondaryGids

public Set<Integer> getSecondaryGids()
Description copied from interface: UidGidSubject
Get the set of secondary GID:s.

Specified by:
getSecondaryGids in interface UidGidSubject
Returns:
The set of secondary GID:s. Possibly empty, but never null.