com.metamatrix.platform.security.api
Class SessionToken

java.lang.Object
  extended by com.metamatrix.platform.security.api.SessionToken
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SessionToken
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class is an immutable identifier for a unique session that also maintains the name of the principal for that session. Since this class can be used to authenticate a user, it must be secure in transit if sent to the client. Also it should only be sent to the client who creates the session.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
SessionToken()
          Fake SessionToken representing a trusted user
SessionToken(MetaMatrixSessionID id, java.lang.String userName)
          The primary constructor that specifies the id, userName, and product info for the session represented by this token.
 
Method Summary
 java.lang.Object clone()
          Return a cloned instance of this object.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 java.util.UUID getSecret()
           
 MetaMatrixSessionID getSessionID()
          Returns unique session identifier
 java.lang.String getSessionIDValue()
          Returns unique session identifier
 java.lang.String getUsername()
          Get the principal name for this session's user.
 int hashCode()
          Overrides Object hashCode method.
 java.lang.String toString()
          Returns a string representing the current state of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

SessionToken

public SessionToken()
Fake SessionToken representing a trusted user


SessionToken

public SessionToken(MetaMatrixSessionID id,
                    java.lang.String userName)
The primary constructor that specifies the id, userName, and product info for the session represented by this token.

Parameters:
id - (long) the unique identifier for the session
userName - (String) the userName for this session
Throws:
java.lang.IllegalArgumentException
Method Detail

getSecret

public java.util.UUID getSecret()

getSessionID

public MetaMatrixSessionID getSessionID()
Returns unique session identifier

Returns:
the session ID

getSessionIDValue

public java.lang.String getSessionIDValue()
Returns unique session identifier

Returns:
the session ID value

getUsername

public java.lang.String getUsername()
Get the principal name for this session's user.

Returns:
the user name

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

hashCode

public int hashCode()
Overrides Object hashCode method.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.hashCode(), Object.equals(Object)

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Return a cloned instance of this object.

Overrides:
clone in class java.lang.Object
Returns:
the object that is the clone of this instance.


Copyright © 2009. All Rights Reserved.