IBM WebSphere Application ServerTM
Release 7

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

java.lang.Object
  extended by com.ibm.wsspi.wssecurity.auth.token.WSSToken
All Implemented Interfaces:
PropagationToken, Token, java.lang.Cloneable
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. Protected by following Java 2 Security permissions: com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.setTrusted") com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.addAttribute") com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.setUsedTokenConsumer")

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 isReadOnly()
           
 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 setReadOnly()
           When called, the token becomes irreversibly read-only.
 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
 

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.

Returns:
id string

setId

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

Parameters:
tid -

getElement

public org.w3c.dom.Element getElement()
Returns DOM expression of the 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.

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.

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.

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).

Parameters:
uri -
localName -

getKeyInfoType

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

Returns:
The KeyInfo's type

setKeyInfoType

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

Parameters:
keyInfoType - The KeyInfo's type

getBytes

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

Specified by:
getBytes in interface 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 Token
Returns:
The implementation class name

getVersion

public short getVersion()
Returns the implementation version

Specified by:
getVersion in interface Token
Returns:
The implementation version

isForwardable

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

Specified by:
isForwardable in interface 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 Token
Overrides:
clone in class java.lang.Object
Returns:
A copy of this class instance

setTrusted

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

Parameters:
trusted - True if auth is required, false otherwise Protected by Java 2 Security permission com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.setTrusted")

isTrusted

public boolean isTrusted()
Returns auth required flag

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.

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.

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 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 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 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 Protected by Java 2 Security Permission com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.addAttribute")

setCallerChecked

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

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.

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.

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.

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.

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.

Parameters:
usedConfig - The token generator configuration

getUsedTokenConsumer

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

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.

Parameters:
usedConfig - The token consumer configuration Protected by Java 2 Security permission com.ibm.websphere.security.WebSphereRuntimePermission("wssecurity.WSSToken.setUsedTokenConsumer")

isProcessed

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

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.

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.

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.

Parameters:
error - The SoapSecurityException that occured during token processing

isReadOnly

public boolean isReadOnly()

setReadOnly

public void setReadOnly()
Description copied from interface: Token

When called, the token becomes irreversibly read-only. The implementation needs to ensure any setter methods check that this has been set.

Specified by:
setReadOnly in interface Token

IBM WebSphere Application ServerTM
Release 7