com.waveset.object
Class Subject

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.Subject
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject

public class Subject
extends AbstractXmlObject

A Subject can be any entity such as a person or service. For our purpose, it will generally be a person attempting to authenticate to the Waveset Provisioning System. A Subject is constructed and saved by the LocalSession at LocalSession construction time. If the Subject is authenticated, it will be populated with one or more Principals as follows:

* User (not assigned to any AdminGroups) * User and one or more AdminGroups to which the User has been assigned

The Subject will be stored in a LocalSession instance variable. Since there will be an instance of a LocalSession per authenticated Waveset user, the associated Subject represents the security credentials for the user and will be used for all authorization decisions.


Field Summary
protected  java.util.List _subjectPrincipals
          When the principals are calculated for this subject, they can be cached here.
static java.lang.String APPLICATION
          The name of an option containing the "application name" to be used in audit events.
static java.lang.String CLIENT_IP
          The name of an option containing the client IP address parameter to be used in audit events.
static java.lang.String code_id
           
static java.lang.String SESSION_ID
          The name of an option containing the Session ID parameter to be used in audit events.
static java.lang.String XML_ELEMENT
          The name of the XML element that wraps this object.
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
Subject()
           
Subject(org.w3c.dom.Element e)
           
Subject(java.lang.String xml)
           
 
Method Summary
 void addAdminRoleRef(ObjectRef arref)
           
 void addPrincipalRef(ObjectRef p)
           
 void checkSubjectTimeout()
           
 void clear()
           
 boolean equals(java.lang.Object anObject)
           
 ObjectRef[] getAdminRoleRefs()
           
 java.lang.String getElementName()
          Return the desired XML element name, required by the XmlObject interface.
 long getLastAccessTime()
           
 java.lang.String getLoginApplication()
          From the subject's options get the login application from which this subject originated.
 ObjectRef getLoginModGrp()
           
 java.lang.String getName()
           
 java.lang.Object getOption(java.lang.String name)
           
 java.util.Map getOptions()
          Get the options associated with this subject.
 ObjectRef[] getPrincipalRefs()
           
 ObjectRef[] getPrincipalRefs(Type type)
           
 java.util.List getSubjectPrincipals()
           
 long getSubjectTimeout()
           
 WSUser getUser(ObjectCache cache)
          Return the WSUser object embedded within this subject.
 boolean isAdministrator()
          Checks to see if the subject represents an Administrator, where an Administrator is defined as a WSUser with at least one AdminGroup (Capability) (e.g.
 boolean isTimedOut()
           
protected  void removePrincipalRefs()
           
 void setAdminRoleRefs(ObjectRef[] adminRoleRefs)
           
 void setLastAccessTime(long lastAccessTime)
           
 void setLoginInProgressName(java.lang.String name)
          Used for setting a subject's name where the login state is "in progress".
 void setLoginModGrp(ObjectRef lmgRef)
           
protected  void setName(java.lang.String name)
           
 void setOption(java.lang.String name, java.lang.Object value)
           
 void setOptions(java.util.Map options)
           
 void setPrincipalRefs(ObjectRef[] parray)
           
protected  void setReadOnly(boolean readOnly)
           
 void setSubjectPrincipals(java.util.List subjectPrincipals)
           
 void setSubjectTimeout(long subjectTimeout)
           
 java.lang.String toString()
           
 java.lang.String toXml()
          A default implementation for rendering as a valid XML document.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize into a buffer with optional indentation.
 void updateLastAccessTime()
           
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

CLIENT_IP

public static final java.lang.String CLIENT_IP
The name of an option containing the client IP address parameter to be used in audit events.

See Also:
Constant Field Values

SESSION_ID

public static final java.lang.String SESSION_ID
The name of an option containing the Session ID parameter to be used in audit events.

See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
The name of an option containing the "application name" to be used in audit events.

See Also:
Constant Field Values

XML_ELEMENT

public static final java.lang.String XML_ELEMENT
The name of the XML element that wraps this object.

See Also:
Constant Field Values

_subjectPrincipals

protected java.util.List _subjectPrincipals
When the principals are calculated for this subject, they can be cached here. This includes the flattened principal directly assigned to a user as well as all Admin Role principals assigned to a user. This will be cleared if the subject is serialized/deserialized.

Constructor Detail

Subject

public Subject()
        throws WavesetException

Subject

public Subject(java.lang.String xml)
        throws WavesetException

Subject

public Subject(org.w3c.dom.Element e)
        throws WavesetException
Method Detail

getElementName

public java.lang.String getElementName()
Return the desired XML element name, required by the XmlObject interface.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

isAdministrator

public boolean isAdministrator()
Checks to see if the subject represents an Administrator, where an Administrator is defined as a WSUser with at least one AdminGroup (Capability) (e.g. "Account Administrator") or AdminRole assigned.


getSubjectPrincipals

public java.util.List getSubjectPrincipals()

setSubjectPrincipals

public void setSubjectPrincipals(java.util.List subjectPrincipals)

getAdminRoleRefs

public ObjectRef[] getAdminRoleRefs()

addAdminRoleRef

public void addAdminRoleRef(ObjectRef arref)
                     throws WSLoginException
Throws:
WSLoginException

setAdminRoleRefs

public void setAdminRoleRefs(ObjectRef[] adminRoleRefs)

getPrincipalRefs

public ObjectRef[] getPrincipalRefs()

getPrincipalRefs

public ObjectRef[] getPrincipalRefs(Type type)

addPrincipalRef

public void addPrincipalRef(ObjectRef p)
                     throws WSLoginException
Throws:
WSLoginException

removePrincipalRefs

protected void removePrincipalRefs()
                            throws WSLoginException
Throws:
WSLoginException

setPrincipalRefs

public void setPrincipalRefs(ObjectRef[] parray)

setReadOnly

protected void setReadOnly(boolean readOnly)

toString

public java.lang.String toString()

getName

public java.lang.String getName()

setName

protected void setName(java.lang.String name)

setLoginInProgressName

public void setLoginInProgressName(java.lang.String name)
Used for setting a subject's name where the login state is "in progress".


equals

public boolean equals(java.lang.Object anObject)
Returns:
true if and only if the specified object is an instance of Subject with the same name.

setOption

public void setOption(java.lang.String name,
                      java.lang.Object value)

getOption

public java.lang.Object getOption(java.lang.String name)

setOptions

public void setOptions(java.util.Map options)

getOptions

public java.util.Map getOptions()
Get the options associated with this subject. This is the place where Constants.CLIENT_IP and Constants.SESSION_ID are stored.


getUser

public WSUser getUser(ObjectCache cache)
               throws WavesetException
Return the WSUser object embedded within this subject. In theory there could be any number of these, but in practice there will always be just one, with any number of AdminGroups.

Throws:
WavesetException

getSubjectTimeout

public long getSubjectTimeout()

setSubjectTimeout

public void setSubjectTimeout(long subjectTimeout)

getLastAccessTime

public long getLastAccessTime()

setLastAccessTime

public void setLastAccessTime(long lastAccessTime)

updateLastAccessTime

public void updateLastAccessTime()

isTimedOut

public boolean isTimedOut()

checkSubjectTimeout

public void checkSubjectTimeout()
                         throws WavesetException
Throws:
WavesetException

clear

public void clear()
           throws WSLoginException
Throws:
WSLoginException

getLoginApplication

public java.lang.String getLoginApplication()
From the subject's options get the login application from which this subject originated. These are things like "Command Line Interface", "IVR Interface", "Administrator Interface" ...


getLoginModGrp

public ObjectRef getLoginModGrp()

setLoginModGrp

public void setLoginModGrp(ObjectRef lmgRef)

toXml

public java.lang.String toXml()
Description copied from class: AbstractXmlObject
A default implementation for rendering as a valid XML document.

Specified by:
toXml in interface XmlObject
Overrides:
toXml in class AbstractXmlObject

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Description copied from class: AbstractXmlObject
Serialize into a buffer with optional indentation. This must be implemented by the subclass.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject