|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.systinet.wasp.security.ws.SecurityTokenSPI
Abstract base class for implementation of WS-Security security tokens. This class contains DOM representation of security token (Element).
It is never created by WSO2 SOA Enablement Server WS-Security implementation, but it is created by corresponding implementation
of SecurityTokenHandlerSPI
. The processing of security tokens in WS-Security is described
in SecurityTokenHandlerSPI
.
If security token is referenced from KeyInfo
(used in EncryptedData, EncryptedKey and Signature)
then it is asked for one or more following keys:
encrypting key
is used on sender side to encrypt data or keys
decrypting key
is used on receiver side to decrypt encrypted data or keys
signing key
is used on sender side to sign message
authenticating key
is used on receiver side to authenticate (verify) signature
claim
(e.g., certificate) which have to be verified on the receiver
side.
Field Summary | |
static int |
PM_GENERATE
Constant denotes WS-Security header generation mode in doFinal(int) method (i.e., message send). |
static int |
PM_RECEIVE
Constant denotes WS-Security header processing mode in doFinal(int) method (i.e., message receive). |
Constructor Summary | |
SecurityTokenSPI(org.w3c.dom.Element element,
SecurityContext securityContext)
Constructor which initializes instance of security token from given element. |
|
SecurityTokenSPI(SecurityContext securityContext,
boolean isExternal)
Constructor which initializes instance of security token from configuration ( SecurityTokenConf is passed
to the constructor of implementation class or the instance can be initialized in SecurityTokenHandlerSPI
implementation). |
Method Summary | |
void |
addAnyAttribute(java.lang.String attrName,
java.lang.String attrValue)
Adds DOM attribute without namespace on the security token element . |
void |
addAnyAttribute(java.lang.String attrNamespaceURI,
java.lang.String attrNamespacePrefix,
java.lang.String attrLocalName,
java.lang.String attrValue)
Adds DOM attribute on the security token element . |
void |
addAnyElement(org.w3c.dom.Element element)
Appends given DOM Element to the security token element children. |
org.w3c.dom.Element |
addAnyElement(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String localName)
Creates and returns DOM Element of given namespace, namespace prefix and local name. |
void |
addBase64Text(byte[] data)
Adds child DOM Textnode to the security token element . |
abstract void |
doFinal(int mode)
Method called as a part of security token processing. |
abstract java.security.Key |
getAuthenticatingKey()
Returns Key for signature authentication represented by security token. |
java.lang.String |
getBaseLocalName()
Returns the local name of the security token element. |
java.lang.String |
getBaseNamespace()
Returns the namespace of the security token element. |
byte[] |
getBytesFromTextChild()
Returns data stored in child DOM Textnode - data are decoded from Base64 encoded content of DOM Textnode. |
abstract java.security.Key |
getDecryptingKey()
Returns Key for decryption represented by security token. |
static java.lang.String |
getDefaultPrefix(java.lang.String namespace)
Returns prefix for given namespace URI . |
org.w3c.dom.Document |
getDocument()
Returns DOM Document of security token element . |
org.w3c.dom.Element |
getElement()
Return DOM Element of security token. |
abstract java.security.Key |
getEncryptingKey()
Returns Key for encryption represented by security token. |
abstract byte[] |
getKeyIdentifier()
Returns value of KeyIdentifier used in SecurityTokenReference/KeyIdentifier. |
java.lang.String |
getKeyIdentifierValueType()
Returns a value, which appears as a value type in the referencing key identifier. |
abstract SecurityTokenConf |
getReceivedConf()
Returns the configuration of security token on the received side. |
SecurityContext |
getSecurityContext()
Returns security context of WS-Security security token processing. |
abstract java.security.Key |
getSigningKey()
Returns Key for signing represented by security token. |
abstract java.lang.String |
getType()
Returns the value type of the security token. |
abstract java.lang.String |
getValueType()
Returns QName of value type (e.g., wsse:X509v3). |
java.lang.String |
getWsuId()
Returns value of wsu:id attribute on the security token element . |
boolean |
isCurrent()
Determine if this token is current. |
boolean |
isExternal()
Returns true if token is configured as ExternalSecurityTokensConf . |
ReceivedCredentials |
mapUser()
Creates received credentials. |
void |
setUniqueWsuId()
Sets wsu:id attribute on the security token element with unique (generated) value. |
void |
setWsuId(java.lang.String wsuId)
Sets wsu:id attribute on the security token element with given value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PM_GENERATE
doFinal(int)
method (i.e., message send).
public static final int PM_RECEIVE
doFinal(int)
method (i.e., message receive).
Constructor Detail |
public SecurityTokenSPI(SecurityContext securityContext, boolean isExternal)
SecurityTokenConf
is passed
to the constructor of implementation class or the instance can be initialized in SecurityTokenHandlerSPI
implementation).
security context
external flag
DOM Element
id
is set to an unique value
- it can be changed in security token constructor to the value
from configuration or other desired value
securityContext
- processing contextisExternal
- flag marking the token as external or notSecurityContext
public SecurityTokenSPI(org.w3c.dom.Element element, SecurityContext securityContext)
element
- DOM Element holding the security tokensecurityContext
- processing contextSecurityContext
Method Detail |
public abstract void doFinal(int mode) throws WSSecurityException
SecurityTokenHandlerSPI
.
mode
- mode of processing - either PM_GENERATE
or PM_RECEIVE
WSSecurityException
public org.w3c.dom.Element getElement()
Initialized in SecurityTokenSPI
constructors
(SecurityTokenSPI(org.systinet.wasp.security.ws.SecurityContext, boolean)
,
SecurityTokenSPI(org.w3c.dom.Element, org.systinet.wasp.security.ws.SecurityContext)
).
public org.w3c.dom.Document getDocument()
element
.
public SecurityContext getSecurityContext()
security context
of WS-Security security token processing.
Initialized in SecurityTokenSPI
constructors
(SecurityTokenSPI(org.systinet.wasp.security.ws.SecurityContext, boolean)
,
SecurityTokenSPI(org.w3c.dom.Element, org.systinet.wasp.security.ws.SecurityContext)
).
public void setUniqueWsuId()
element
with unique (generated) value.
public void setWsuId(java.lang.String wsuId)
element
with given value.
public java.lang.String getWsuId()
element
.
null
if does not exist.public abstract byte[] getKeyIdentifier()
null
.
null
if token does not support reference via keyIdentifierpublic abstract java.lang.String getValueType()
null
.
null
(if token does not support valueType)public void addAnyAttribute(java.lang.String attrNamespaceURI, java.lang.String attrNamespacePrefix, java.lang.String attrLocalName, java.lang.String attrValue)
element
. If attribute is not in
namespace, then both attrNamespaceURI
and attrNamespacePrefix
must be null
or
you can use addAnyAttribute(java.lang.String, java.lang.String)
.
attrNamespaceURI
- namespace URI of attributeattrNamespacePrefix
- namespace prefix of attributeattrLocalName
- local name of attributeattrValue
- value of attributepublic void addAnyAttribute(java.lang.String attrName, java.lang.String attrValue)
element
.
attrName
- name of attributeattrValue
- value of attributeaddAnyAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void addAnyElement(org.w3c.dom.Element element)
element
children. After appended element
the DOM Textnode with value "\n" is appended.
element
- appended DOM Elementpublic org.w3c.dom.Element addAnyElement(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
element
children using addAnyElement(org.w3c.dom.Element)
.
namespaceURI
- namespace URI of elementprefix
- namespace prefix of elementlocalName
- local name of element
public void addBase64Text(byte[] data)
element
.
The node contains Base64
String of given data
.
data
- byte array of datagetBytesFromTextChild()
public byte[] getBytesFromTextChild()
Base64
encoded content of DOM Textnode.
addBase64Text(byte[])
public static java.lang.String getDefaultPrefix(java.lang.String namespace)
prefix
for given namespace URI
.
namespace
- asked namespace URI
null
if namespace's prefix is not knownpublic abstract java.security.Key getEncryptingKey() throws WSSecurityException
Key
for encryption represented by security token.
WSSecurityException
- if it is not possible to return the keygetDecryptingKey()
public abstract java.security.Key getDecryptingKey() throws WSSecurityException
Key
for decryption represented by security token.
WSSecurityException
- if it is not possible to return the keygetEncryptingKey()
public abstract java.security.Key getSigningKey() throws WSSecurityException
Key
for signing represented by security token.
WSSecurityException
- if it is not possible to return the keygetAuthenticatingKey()
public abstract java.security.Key getAuthenticatingKey() throws WSSecurityException
Key
for signature authentication represented by security token.
WSSecurityException
- if it is not possible to return the keygetSigningKey()
public abstract SecurityTokenConf getReceivedConf()
SecurityTokenSPI(org.w3c.dom.Element, org.systinet.wasp.security.ws.SecurityContext)
on the receiver side, then
this method is called during the processing
.
Developer must use SecurityContext.getMessageConf()
to create the configuration - the security token configuration holder
is created using MessageConf.newSecurityToken
.
The MessageConf object
returned
by SecurityContext.getMessageConf()
must not be altered.
getSecurityContext()
public abstract java.lang.String getType()
processing
for details
how value type is used.
Constants.ST_VALUE_TYPE_USERNAME
,
Constants.ST_VALUE_TYPE_X509V3
,
Constants.ST_VALUE_TYPE_SYMMETRICKEY
public java.lang.String getBaseNamespace()
SecurityContext.getWsseNamespace()
by defaultpublic java.lang.String getBaseLocalName()
WSSecurity.ELEMENT_BINARY_SECURITY_TOKEN
by default.
public boolean isExternal()
true
if token is configured as ExternalSecurityTokensConf
.
true
if token is configured as ExternalSecurityTokensConf
.public java.lang.String getKeyIdentifierValueType()
getValueType()
.
public ReceivedCredentials mapUser()
null
by defaultpublic boolean isCurrent()
true
(default) if this token is currently current, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |