com.waveset.object
Class Subject

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

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
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.
 
Constructor Summary
Subject()
           
Subject(org.w3c.dom.Element e)
           
Subject(java.lang.String xml)
           
 
Method Summary
 void addAdminRoleRef(com.waveset.object.ObjectRef arref)
           
 void addPrincipalRef(com.waveset.object.ObjectRef p)
           
 void checkSubjectTimeout()
           
 void clear()
           
 boolean equals(java.lang.Object anObject)
           
 com.waveset.object.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.
 com.waveset.object.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.
 com.waveset.object.ObjectRef[] getPrincipalRefs()
           
 com.waveset.object.ObjectRef[] getPrincipalRefs(com.waveset.object.Type type)
           
 java.util.List getSubjectPrincipals()
           
 long getSubjectTimeout()
           
 WSUser getUser(com.waveset.object.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()
           
 void setAdminRoleRefs(com.waveset.object.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(com.waveset.object.ObjectRef lmgRef)
           
 void setOption(java.lang.String name, java.lang.Object value)
           
 void setOptions(java.util.Map options)
           
 void setPrincipalRefs(com.waveset.object.ObjectRef[] parray)
           
 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, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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

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

code_id

public static final java.lang.String code_id
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

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
Constructor Detail

Subject

public Subject()
        throws com.waveset.util.WavesetException
Throws:
com.waveset.util.WavesetException

Subject

public Subject(org.w3c.dom.Element e)
        throws com.waveset.util.WavesetException
Throws:
com.waveset.util.WavesetException

Subject

public Subject(java.lang.String xml)
        throws com.waveset.util.WavesetException
Throws:
com.waveset.util.WavesetException
Method Detail

addAdminRoleRef

public void addAdminRoleRef(com.waveset.object.ObjectRef arref)
                     throws com.waveset.util.WSLoginException
Throws:
com.waveset.util.WSLoginException

addPrincipalRef

public void addPrincipalRef(com.waveset.object.ObjectRef p)
                     throws com.waveset.util.WSLoginException
Throws:
com.waveset.util.WSLoginException

checkSubjectTimeout

public void checkSubjectTimeout()
                         throws com.waveset.util.WavesetException
Throws:
com.waveset.util.WavesetException

clear

public void clear()
           throws com.waveset.util.WSLoginException
Throws:
com.waveset.util.WSLoginException

equals

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

getAdminRoleRefs

public com.waveset.object.ObjectRef[] getAdminRoleRefs()

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
Returns:
the element name

getLastAccessTime

public long getLastAccessTime()

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 com.waveset.object.ObjectRef getLoginModGrp()

getName

public java.lang.String getName()

getOption

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

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.


getPrincipalRefs

public com.waveset.object.ObjectRef[] getPrincipalRefs()

getPrincipalRefs

public com.waveset.object.ObjectRef[] getPrincipalRefs(com.waveset.object.Type type)

getSubjectPrincipals

public java.util.List getSubjectPrincipals()

getSubjectTimeout

public long getSubjectTimeout()

getUser

public WSUser getUser(com.waveset.object.ObjectCache cache)
               throws com.waveset.util.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:
com.waveset.util.WavesetException

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.


isTimedOut

public boolean isTimedOut()

setAdminRoleRefs

public void setAdminRoleRefs(com.waveset.object.ObjectRef[] adminRoleRefs)

setLastAccessTime

public void setLastAccessTime(long lastAccessTime)

setLoginInProgressName

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


setLoginModGrp

public void setLoginModGrp(com.waveset.object.ObjectRef lmgRef)

setOption

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

setOptions

public void setOptions(java.util.Map options)

setPrincipalRefs

public void setPrincipalRefs(com.waveset.object.ObjectRef[] parray)

setSubjectPrincipals

public void setSubjectPrincipals(java.util.List subjectPrincipals)

setSubjectTimeout

public void setSubjectTimeout(long subjectTimeout)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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
Returns:
the string representation of this object

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
Parameters:
b - StringBuffer in which to write the generated xml
indent - Number of spaces to indent the generated xml block

updateLastAccessTime

public void updateLastAccessTime()