org.systinet.wasp.security.ws
Class SecurityTokenHandlerSPI

java.lang.Object
  extended byorg.systinet.wasp.security.ws.SecurityTokenHandlerSPI

public abstract class SecurityTokenHandlerSPI
extends java.lang.Object

Abstract base class for implementation of WS-Security security token handlers. Implementations of this class handle custom binary security tokens only. Custom binary security token are distinguished by valueType, that indicates token's "value space". Implementation of security token handler handles corresponding implementation of security token.

Security token handler and Security token processing:


To add security token handler to the processing, it has to be added to the list of security token handlers:

Since:
4.6
Component:
Security-Providers

Constructor Summary
SecurityTokenHandlerSPI()
           
 
Method Summary
static void addSecurityTokenHandler(SecurityTokenHandlerSPI securityTokenHandler)
          This method adds security token handler to the list of security token handlers in the runtime.
abstract  SecurityTokenSPI createFromConf(SecurityTokenConf tokenConf, SecurityContext securityContext, boolean isExternal)
          Creates a security token from given configuration.
abstract  SecurityTokenSPI createFromXML(org.w3c.dom.Element tokenElement, SecurityContext securityContext)
          Creates the security token from the given element on the receiver side.
 java.lang.String getLocalElementName()
          This method is used on the receiver's side to map received element to corresponding security token handler.
abstract  java.lang.String getLocalValueType()
          Returns local part of the security token valueType handled by the handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityTokenHandlerSPI

public SecurityTokenHandlerSPI()
Method Detail

getLocalValueType

public abstract java.lang.String getLocalValueType()
Returns local part of the security token valueType handled by the handler. Used on both sender's and receiver's sides.

Returns:
local part of value type QName or URI fragment (e.g., X509v3)

createFromConf

public abstract SecurityTokenSPI createFromConf(SecurityTokenConf tokenConf,
                                                SecurityContext securityContext,
                                                boolean isExternal)
                                         throws WSSecurityException
Creates a security token from given configuration. It also notifies token that it is configured as ExternalSecurityTokensConf. If it is not possible to create security token from given configuration WSSecurityException must be thrown.

Parameters:
tokenConf - the configuration
isExternal - external token flag
Returns:
created instance of security token
Throws:
WSSecurityException - thrown if security token instance cannot be created from the configuration or created security token is invalid

getLocalElementName

public java.lang.String getLocalElementName()
This method is used on the receiver's side to map received element to corresponding security token handler.

Returns:
BinarySecurityToken by default

createFromXML

public abstract SecurityTokenSPI createFromXML(org.w3c.dom.Element tokenElement,
                                               SecurityContext securityContext)
                                        throws WSSecurityException
Creates the security token from the given element on the receiver side. If any problem occures during the creation of security token instance (e.g., untrusted certificate) the WSSecurityException must be thrown.

Parameters:
tokenElement - element, which represents the security token in the XML
Returns:
instance of security token
Throws:
WSSecurityException - thrown if security token instance cannot be created from the element or created security token is invalid

addSecurityTokenHandler

public static void addSecurityTokenHandler(SecurityTokenHandlerSPI securityTokenHandler)
This method adds security token handler to the list of security token handlers in the runtime. This list can be persistently configured in WSSEGlobalConf.setSecurityTokenHandlers.

Parameters:
securityTokenHandler - instance of security token handler