org.teiid.client.security
Class SessionToken

java.lang.Object
  extended by org.teiid.client.security.SessionToken
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class SessionToken
extends java.lang.Object
implements java.io.Externalizable

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()
           
SessionToken(long id, java.lang.String userName)
          Used by tests to control the session id
SessionToken(java.lang.String userName)
          The primary constructor that specifies userName
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getSessionID()
          Returns unique session identifier
 java.lang.String getUsername()
          Get the principal name for this session's user.
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toString()
          Returns a string representing the current state of the object.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

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

SessionToken

public SessionToken()

SessionToken

public SessionToken(long id,
                    java.lang.String userName)
Used by tests to control the session id

Parameters:
id -
userName -

SessionToken

public SessionToken(java.lang.String userName)
The primary constructor that specifies userName

Parameters:
userName - (String) the userName for this session
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getSessionID

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

Returns:
the session ID

getUsername

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

Returns:
the user name

toString

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

Overrides:
toString in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.