org.apache.rahas
Class Token

java.lang.Object
  extended by org.apache.rahas.Token
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
EncryptedKeyToken

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

This represents a security token which can have either one of 4 states.

Also this holds the OMElements representing the token in its present state and the previous state.

These tokens are stored using the storage mechanism provided via the TokenStorage interface.

See Also:
TokenStorage, Serialized Form

Field Summary
static int CANCELLED
           
static int EXPIRED
           
static int ISSUED
           
static int RENEWED
           
 
Constructor Summary
Token()
           
Token(java.lang.String id, java.util.Date created, java.util.Date expires)
           
Token(java.lang.String id, org.apache.axiom.om.OMElement tokenElem, java.util.Date created, java.util.Date expires)
           
Token(java.lang.String id, org.apache.axiom.om.OMElement tokenElem, org.apache.axiom.om.OMElement lifetimeElem)
           
 
Method Summary
 org.apache.axiom.om.OMElement getAttachedReference()
           
 java.util.Date getCreated()
           
 java.util.Date getExpires()
           
 java.lang.String getId()
           
 java.lang.String getIssuerAddress()
           
 org.apache.axiom.om.OMElement getPreviousToken()
           
 java.util.Properties getProperties()
           
 byte[] getSecret()
           
 int getState()
           
 org.apache.axiom.om.OMElement getToken()
           
 org.apache.axiom.om.OMElement getUnattachedReference()
           
 boolean isChanged()
           
 void readExternal(java.io.ObjectInput in)
          Implementing de-serialization logic in accordance with the serialization logic.
 void setAttachedReference(org.apache.axiom.om.OMElement attachedReference)
           
 void setChanged(boolean chnaged)
           
 void setExpires(java.util.Date expires)
           
 void setIssuerAddress(java.lang.String issuerAddress)
           
 void setPreviousToken(org.apache.axiom.om.OMElement presivousToken)
           
 void setProperties(java.util.Properties properties)
           
 void setSecret(byte[] secret)
           
 void setState(int state)
           
 void setToken(org.apache.axiom.om.OMElement token)
           
 void setUnattachedReference(org.apache.axiom.om.OMElement unattachedReference)
           
 void writeExternal(java.io.ObjectOutput out)
          Implementing serialize logic according to our own protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISSUED

public static final int ISSUED
See Also:
Constant Field Values

EXPIRED

public static final int EXPIRED
See Also:
Constant Field Values

CANCELLED

public static final int CANCELLED
See Also:
Constant Field Values

RENEWED

public static final int RENEWED
See Also:
Constant Field Values
Constructor Detail

Token

public Token()

Token

public Token(java.lang.String id,
             java.util.Date created,
             java.util.Date expires)

Token

public Token(java.lang.String id,
             org.apache.axiom.om.OMElement tokenElem,
             java.util.Date created,
             java.util.Date expires)
      throws TrustException
Throws:
TrustException

Token

public Token(java.lang.String id,
             org.apache.axiom.om.OMElement tokenElem,
             org.apache.axiom.om.OMElement lifetimeElem)
      throws TrustException
Throws:
TrustException
Method Detail

isChanged

public boolean isChanged()
Returns:
Returns the changed.

setChanged

public void setChanged(boolean chnaged)
Parameters:
chnaged - The changed to set.

getProperties

public java.util.Properties getProperties()
Returns:
Returns the properties.

setProperties

public void setProperties(java.util.Properties properties)
Parameters:
properties - The properties to set.

getState

public int getState()
Returns:
Returns the state.

setState

public void setState(int state)
Parameters:
state - The state to set.

getToken

public org.apache.axiom.om.OMElement getToken()
Returns:
Returns the token.

setToken

public void setToken(org.apache.axiom.om.OMElement token)
Parameters:
token - The token to set.

getId

public java.lang.String getId()
Returns:
Returns the id.

getPreviousToken

public org.apache.axiom.om.OMElement getPreviousToken()
Returns:
Returns the presivousToken.

setPreviousToken

public void setPreviousToken(org.apache.axiom.om.OMElement presivousToken)
Parameters:
presivousToken - The presivousToken to set.

getSecret

public byte[] getSecret()
Returns:
Returns the secret.

setSecret

public void setSecret(byte[] secret)
Parameters:
secret - The secret to set.

getAttachedReference

public org.apache.axiom.om.OMElement getAttachedReference()
Returns:
Returns the attachedReference.

setAttachedReference

public void setAttachedReference(org.apache.axiom.om.OMElement attachedReference)
Parameters:
attachedReference - The attachedReference to set.

getUnattachedReference

public org.apache.axiom.om.OMElement getUnattachedReference()
Returns:
Returns the unattachedReference.

setUnattachedReference

public void setUnattachedReference(org.apache.axiom.om.OMElement unattachedReference)
Parameters:
unattachedReference - The unattachedReference to set.

getCreated

public java.util.Date getCreated()
Returns:
Returns the created.

getExpires

public java.util.Date getExpires()
Returns:
Returns the expires.

setExpires

public void setExpires(java.util.Date expires)
Parameters:
expires - The expires to set.

getIssuerAddress

public java.lang.String getIssuerAddress()

setIssuerAddress

public void setIssuerAddress(java.lang.String issuerAddress)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Implementing serialize logic according to our own protocol. We had to follow this, because OMElement class is not serializable. Making OMElement serializable will have an huge impact on other components. Therefore implementing serialization logic according to a manual protocol.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - Stream which writes serialized bytes.
Throws:
java.io.IOException - If unable to serialize particular member.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implementing de-serialization logic in accordance with the serialization logic.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - Stream which used to read data.
Throws:
java.io.IOException - If unable to de-serialize particular data member.
java.lang.ClassNotFoundException