com.ibm.wsspi.wssecurity.auth.token
Class WSSToken

java.lang.Object
  extended bycom.ibm.wsspi.wssecurity.auth.token.WSSToken
All Implemented Interfaces:
java.lang.Cloneable, com.ibm.wsspi.security.token.PropagationToken, Token, com.ibm.wsspi.security.token.Token
Direct Known Subclasses:
LTPAToken, UsernameToken, X509BSToken

public abstract class WSSToken
extends java.lang.Object
implements Token

A default implementation of the Token interface for processing security tokens.

See Also:
Token

Nested Class Summary
protected  class WSSToken.AttributesEnumerator
           
 
Field Summary
protected  java.util.HashMap _attributes
           
protected  boolean _callerChecked
           
protected  SoapSecurityException _error
           
protected  java.lang.String _keyInfoType
           
protected  boolean _processed
           
protected  boolean _referenced
           
protected  org.w3c.dom.Element _tokenelem
           
protected  java.lang.String _tokenId
           
protected  boolean _trusted
           
protected  TokenConsumerConfig _usedTokenConsumer
           
protected  TokenGeneratorConfig _usedTokenGenerator
           
protected  boolean _usedToLogin
           
protected static short _version
           
protected  javax.xml.namespace.QName _vtype
           
 
Constructor Summary
WSSToken()
           
 
Method Summary
 java.lang.String[] addAttribute(java.lang.String key, java.lang.String value)
          Adds an attribute in the form of a key-value pair.
 java.lang.Object clone()
          Returns a copy of this class instance
 java.util.Enumeration getAttributeNames()
          Returns the enumeration of attribute names.
 java.lang.String[] getAttributes(java.lang.String key)
          Returns the attributes of the specified key.
 byte[] getBytes()
          Returns the byte array representation of this token if possible.
 boolean getCallerChecked()
          Returns if the caller check has been done or not.
 org.w3c.dom.Element getElement()
          Returns DOM expression of the token.
 SoapSecurityException getError()
          Returns the error that occurs during token processing.
 java.lang.String getId()
          Returns id string of this token.
 java.lang.String getKeyInfoType()
          Gets the KeyInfo's type.
 java.lang.String getName()
          Returns the implementation class name
 javax.xml.namespace.QName getType()
          Returns the value type of the token in the form of a QName object.
 TokenConsumerConfig getUsedTokenConsumer()
          Returns the configuration of token consumer.
 TokenGeneratorConfig getUsedTokenGenerator()
          Returns the configuration of token generator.
 boolean getUsedToLogin()
          Checks whether the token is used to login or not.
 short getVersion()
          Returns the implementation version
 boolean isForwardable()
          Checks if the token is forwardable or not
 boolean isProcessed()
          Returns if the token is processed or not.
 boolean isReferenced()
          Returns if the token is referenced in the message or not.
 boolean isTrusted()
          Returns auth required flag
 void setCallerChecked(boolean isCallerChecked)
          Sets the whether the caller check has been done or not.
 void setElement(org.w3c.dom.Element elem)
          Sets DOM expression of the token.
 void setError(SoapSecurityException error)
          Sets the error that occurs during token processing.
 void setId(java.lang.String tid)
          Sets id string of this token.
 void setKeyInfoType(java.lang.String keyInfoType)
          Sets the KeyInfo's type.
 void setProcessed(boolean isProcessed)
          Sets if the token is processed or not.
 void setReferenced(boolean isReferenced)
          Sets whether the token is referenced in the message or not.
 void setTrusted(boolean trusted)
          Sets auth required flag.
 void setType(javax.xml.namespace.QName type)
          Sets the value type of the token in the form of a QName object.
 void setType(java.lang.String uri, java.lang.String localName)
          Sets the value type of the token by a URI -- local name pair (i.e., qname).
 void setUsedTokenConsumer(TokenConsumerConfig usedConfig)
          Sets the configuration of token consumer.
 void setUsedTokenGenerator(TokenGeneratorConfig usedConfig)
          Sets the configuration of token generator.
 void setUsedToLogin(boolean usedToLogin)
          Sets the flag that indicates whether the token is used to login.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.wsspi.security.token.Token
getExpiration, getPrincipal, getUniqueID, isValid, setReadOnly
 

Field Detail

_version

protected static final short _version
See Also:
Constant Field Values

_attributes

protected java.util.HashMap _attributes

_tokenId

protected java.lang.String _tokenId

_tokenelem

protected org.w3c.dom.Element _tokenelem

_vtype

protected javax.xml.namespace.QName _vtype

_keyInfoType

protected java.lang.String _keyInfoType

_trusted

protected boolean _trusted

_usedToLogin

protected boolean _usedToLogin

_callerChecked

protected boolean _callerChecked

_referenced

protected boolean _referenced

_usedTokenGenerator

protected TokenGeneratorConfig _usedTokenGenerator

_usedTokenConsumer

protected TokenConsumerConfig _usedTokenConsumer

_processed

protected boolean _processed

_error

protected SoapSecurityException _error
Constructor Detail

WSSToken

public WSSToken()
Method Detail

getId

public java.lang.String getId()
Returns id string of this token.

Specified by:
getId in interface Token
Returns:
id string

setId

public void setId(java.lang.String tid)
Sets id string of this token.

Specified by:
setId in interface Token
Parameters:
tid -

getElement

public org.w3c.dom.Element getElement()
Returns DOM expression of the token.

Specified by:
getElement in interface Token
Returns:
a token element in the form of Element object

setElement

public void setElement(org.w3c.dom.Element elem)
Sets DOM expression of the token.

Specified by:
setElement in interface Token
Parameters:
elem - An Element of the token itself

getType

public javax.xml.namespace.QName getType()
Returns the value type of the token in the form of a QName object.

Specified by:
getType in interface Token
Returns:
A value type

setType

public void setType(javax.xml.namespace.QName type)
Sets the value type of the token in the form of a QName object.

Specified by:
setType in interface Token
Parameters:
type - a qname of the token

setType

public void setType(java.lang.String uri,
                    java.lang.String localName)
Sets the value type of the token by a URI -- local name pair (i.e., qname).

Specified by:
setType in interface Token
Parameters:
uri -
localName -

getKeyInfoType

public java.lang.String getKeyInfoType()
Gets the KeyInfo's type.

Specified by:
getKeyInfoType in interface Token
Returns:
The KeyInfo's type

setKeyInfoType

public void setKeyInfoType(java.lang.String keyInfoType)
Sets the KeyInfo's type.

Specified by:
setKeyInfoType in interface Token
Parameters:
keyInfoType - The KeyInfo's type
Returns:
The KeyInfo's type

getBytes

public byte[] getBytes()
Returns the byte array representation of this token if possible.

Specified by:
getBytes in interface com.ibm.wsspi.security.token.Token
Returns:
The byte array representation of this token

getName

public java.lang.String getName()
Returns the implementation class name

Specified by:
getName in interface com.ibm.wsspi.security.token.Token
Returns:
The implementation class name

getVersion

public short getVersion()
Returns the implementation version

Specified by:
getVersion in interface com.ibm.wsspi.security.token.Token
Returns:
The implementation version

isForwardable

public boolean isForwardable()
Checks if the token is forwardable or not

Specified by:
isForwardable in interface com.ibm.wsspi.security.token.Token
Returns:
True if the token is forwardable, false otherwise

clone

public java.lang.Object clone()
Returns a copy of this class instance

Specified by:
clone in interface com.ibm.wsspi.security.token.Token
Returns:
A copy of this class instance

setTrusted

public void setTrusted(boolean trusted)
Sets auth required flag.

Specified by:
setTrusted in interface Token
Parameters:
trusted - True if auth is required, false otherwise

isTrusted

public boolean isTrusted()
Returns auth required flag

Specified by:
isTrusted in interface Token
Returns:
True if auth is required, false otherwise

setUsedToLogin

public void setUsedToLogin(boolean usedToLogin)
Sets the flag that indicates whether the token is used to login.

Specified by:
setUsedToLogin in interface Token
Parameters:
usedToLogin - True if the token is used to login, false otherwise

getUsedToLogin

public boolean getUsedToLogin()
Checks whether the token is used to login or not.

Specified by:
getUsedToLogin in interface Token
Returns:
True if the token is used to login, false otherwise

getAttributeNames

public java.util.Enumeration getAttributeNames()
Returns the enumeration of attribute names.

Specified by:
getAttributeNames in interface com.ibm.wsspi.security.token.Token
Returns:
The enumeration of attribute names

getAttributes

public java.lang.String[] getAttributes(java.lang.String key)
Returns the attributes of the specified key.

Specified by:
getAttributes in interface com.ibm.wsspi.security.token.Token
Parameters:
key - The key of the attributes to retrieve
Returns:
The String[] of attributes of the specified key

addAttribute

public java.lang.String[] addAttribute(java.lang.String key,
                                       java.lang.String value)
Adds an attribute in the form of a key-value pair.

Specified by:
addAttribute in interface com.ibm.wsspi.security.token.Token
Parameters:
key - The key of the attribute to add
value - The value of the attribute to add
Returns:
The String[] representation of the set of attributes

setCallerChecked

public void setCallerChecked(boolean isCallerChecked)
Sets the whether the caller check has been done or not.

Specified by:
setCallerChecked in interface Token
Parameters:
isCallerChecked - True if caller check has been done, false otherwise

getCallerChecked

public boolean getCallerChecked()
Returns if the caller check has been done or not.

Specified by:
getCallerChecked in interface Token
Returns:
True if the caller check has been done, false otherwise

isReferenced

public boolean isReferenced()
Returns if the token is referenced in the message or not.

Specified by:
isReferenced in interface Token
Returns:
True if the token is referenced, false otherwise

setReferenced

public void setReferenced(boolean isReferenced)
Sets whether the token is referenced in the message or not.

Specified by:
setReferenced in interface Token
Parameters:
isReferenced - True if the token is referenced, false otherwise

getUsedTokenGenerator

public TokenGeneratorConfig getUsedTokenGenerator()
Returns the configuration of token generator. This method is used only at generator side.

Specified by:
getUsedTokenGenerator in interface Token
Returns:
the token generator configuration

setUsedTokenGenerator

public void setUsedTokenGenerator(TokenGeneratorConfig usedConfig)
Sets the configuration of token generator. This method is used only at generator side.

Specified by:
setUsedTokenGenerator in interface Token
Parameters:
usedConfig - The token generator configuration

getUsedTokenConsumer

public TokenConsumerConfig getUsedTokenConsumer()
Returns the configuration of token consumer. This method is used only at consumer side.

Specified by:
getUsedTokenConsumer in interface Token
Returns:
the token consumer configuration

setUsedTokenConsumer

public void setUsedTokenConsumer(TokenConsumerConfig usedConfig)
Sets the configuration of token consumer. This method is used only at consumer side.

Specified by:
setUsedTokenConsumer in interface Token
Parameters:
usedConfig - The token consumer configuration

isProcessed

public boolean isProcessed()
Returns if the token is processed or not. This method is used only at consumer side.

Specified by:
isProcessed in interface Token
Returns:
True if the token is processed, false otherwise

setProcessed

public void setProcessed(boolean isProcessed)
Sets if the token is processed or not. This method is used only at consumer side.

Specified by:
setProcessed in interface Token
Parameters:
isProcessed - True if the token is processed, false otherwise

getError

public SoapSecurityException getError()
Returns the error that occurs during token processing. This method is used only at consumer side.

Specified by:
getError in interface Token
Returns:
The SoapSecurityException that occured during token processing

setError

public void setError(SoapSecurityException error)
Sets the error that occurs during token processing. This method is used only at consumer side.

Specified by:
setError in interface Token
Parameters:
error - The SoapSecurityException that occured during token processing