public class SecurityTokenReference extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Element |
element |
static String |
ENC_KEY_SHA1_URI |
static String |
SECURITY_TOKEN_REFERENCE |
static String |
SKI_URI |
static QName |
STR_QNAME |
static String |
THUMB_URI |
| Constructor and Description |
|---|
SecurityTokenReference(Document doc)
Constructor.
|
SecurityTokenReference(Element elem)
Constructor.
|
SecurityTokenReference(Element elem,
boolean bspCompliant)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTokenType(String tokenType)
Add a wsse11:TokenType attribute to this SecurityTokenReference
|
void |
addWSSENamespace()
Add the WSSE Namespace to this STR.
|
void |
addWSUNamespace()
Add the WSU Namespace to this STR.
|
boolean |
containsKeyIdentifier()
Method containsKeyIdentifier.
|
boolean |
containsReference()
Method containsReference
|
boolean |
containsX509Data()
Method containsX509Data
|
boolean |
containsX509IssuerSerial()
Method containsX509IssuerSerial
|
boolean |
equals(Object object) |
Element |
findProcessedTokenElement(Document doc,
WSDocInfo docInfo,
CallbackHandler cb,
String uri,
String type)
Find a token that has been processed already - in other words, it access previous
results to find the element, rather than conducting a general search
|
Element |
findUnprocessedTokenElement(Document doc,
WSDocInfo docInfo,
CallbackHandler cb,
String uri,
String type)
Find a token that has not been processed already - in other words, it searches for
the element, rather than trying to access previous results to find the element
|
Element |
getElement()
Get the DOM element.
|
Element |
getFirstElement()
get the first child element.
|
String |
getID()
Get the id
|
X509Certificate[] |
getKeyIdentifier(Crypto crypto)
Gets the KeyIdentifier.
|
String |
getKeyIdentifierEncodingType() |
String |
getKeyIdentifierValue() |
String |
getKeyIdentifierValueType() |
Reference |
getReference()
Gets the Reference.
|
byte[] |
getSKIBytes() |
Element |
getTokenElement(Document doc,
WSDocInfo docInfo,
CallbackHandler cb)
Gets the signing token element, which may be a
BinarySecurityToken
or a SAML token. |
String |
getTokenType()
Get the wsse11:TokenType attribute of this SecurityTokenReference
|
X509Certificate[] |
getX509IssuerSerial(Crypto crypto)
Gets the certificate identified with X509 issuerSerial data.
|
X509Certificate |
getX509SKIAlias(Crypto crypto) |
int |
hashCode() |
int |
length(String namespace,
String localname)
Method length.
|
int |
lengthKeyIdentifier()
Method lengthKeyIdentifier.
|
int |
lengthReference()
Method lengthReference.
|
int |
lengthX509Data()
Method lengthX509Data.
|
int |
lengthX509IssuerSerial()
Method lengthX509IssuerSerial.
|
void |
setID(String id)
set the id.
|
void |
setKeyIdentifier(String valueType,
String keyIdVal) |
void |
setKeyIdentifier(String valueType,
String keyIdVal,
boolean base64) |
void |
setKeyIdentifier(X509Certificate cert)
Sets the KeyIdentifier Element as a X509 certificate.
|
void |
setKeyIdentifierEncKeySHA1(String value) |
void |
setKeyIdentifierSKI(X509Certificate cert,
Crypto crypto)
Sets the KeyIdentifier Element as a X509 Subject-Key-Identifier (SKI).
|
void |
setKeyIdentifierThumb(X509Certificate cert)
Sets the KeyIdentifier Element as a Thumbprint.
|
void |
setReference(Reference ref)
set the reference.
|
void |
setUnknownElement(Element unknownElement)
Set an unknown element.
|
void |
setX509Data(DOMX509Data domX509Data)
Sets the X509Data.
|
String |
toString()
return the string representation.
|
public static final String SECURITY_TOKEN_REFERENCE
public static final QName STR_QNAME
public static final String SKI_URI
public static final String THUMB_URI
public static final String ENC_KEY_SHA1_URI
protected Element element
public SecurityTokenReference(Element elem) throws WSSecurityException
elem - A SecurityTokenReference elementWSSecurityExceptionpublic SecurityTokenReference(Element elem, boolean bspCompliant) throws WSSecurityException
elem - A SecurityTokenReference elementbspCompliant - whether the SecurityTokenReference processing complies with the
BSP specWSSecurityExceptionpublic SecurityTokenReference(Document doc)
doc - The Documentpublic void addWSSENamespace()
public void addWSUNamespace()
public void addTokenType(String tokenType)
tokenType - the wsse11:TokenType attribute to addpublic String getTokenType()
public void setReference(Reference ref)
ref - public Reference getReference() throws WSSecurityException
Reference element contained in this
SecurityTokenReferenceWSSecurityExceptionpublic Element getTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb) throws WSSecurityException
BinarySecurityToken
or a SAML token.
The method gets the URI attribute of the Reference contained in
the SecurityTokenReference and tries to find the referenced
Element in the document. Alternatively, it gets the value of the KeyIdentifier
contained in the SecurityTokenReference and tries to find the referenced
Element in the document.doc - the document that contains the binary security token
element. This could be different from the document
that contains the SecurityTokenReference (STR). See
STRTransform.derefenceBST() methoddocInfo - A WSDocInfo object containing previous resultscb - A CallbackHandler object to obtain tokens that are not in the messageWSSecurityException - if the referenced element is not found.public Element findUnprocessedTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String type) throws WSSecurityException
doc - Parent DocumentdocInfo - WSDocInfo instancecb - CallbackHandler instanceuri - URI of the elementtype - Type of the elementWSSecurityExceptionpublic Element findProcessedTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String type) throws WSSecurityException
doc - Parent DocumentdocInfo - WSDocInfo instancecb - CallbackHandler instanceuri - URI of the elementtype - Type of the elementWSSecurityExceptionpublic void setKeyIdentifier(X509Certificate cert) throws WSSecurityException
wsse:KeyIdentifier element, which is placed
in the wsse:SecurityTokenReference element.cert - is the X509 certificate to be inserted as key identifierWSSecurityExceptionpublic void setKeyIdentifierSKI(X509Certificate cert, Crypto crypto) throws WSSecurityException
wsse:KeyIdentifier element, which is placed
in the wsse:SecurityTokenReference element.cert - is the X509 certificate to get the SKIcrypto - is the Crypto implementation. Used to read SKI info bytes from certificateWSSecurityExceptionpublic void setKeyIdentifierThumb(X509Certificate cert) throws WSSecurityException
wsse:KeyIdentifier
element, which is placed in the wsse:SecurityTokenReference
element.cert - is the X509 certificate to get the thumbprintWSSecurityExceptionpublic void setKeyIdentifierEncKeySHA1(String value) throws WSSecurityException
WSSecurityExceptionpublic void setKeyIdentifier(String valueType, String keyIdVal) throws WSSecurityException
WSSecurityExceptionpublic void setKeyIdentifier(String valueType, String keyIdVal, boolean base64) throws WSSecurityException
WSSecurityExceptionpublic Element getFirstElement()
Element child nodepublic X509Certificate[] getKeyIdentifier(Crypto crypto) throws WSSecurityException
WSSecurityExceptionpublic String getKeyIdentifierValue()
public String getKeyIdentifierValueType()
public String getKeyIdentifierEncodingType()
public X509Certificate getX509SKIAlias(Crypto crypto) throws WSSecurityException
WSSecurityExceptionpublic byte[] getSKIBytes()
public void setX509Data(DOMX509Data domX509Data)
domX509Data - the DOMX509Data to put into this
SecurityTokenReferencepublic void setUnknownElement(Element unknownElement)
unknownElement - the org.w3c.dom.Element to put into this
SecurityTokenReferencepublic X509Certificate[] getX509IssuerSerial(Crypto crypto) throws WSSecurityException
WSSecurityExceptionpublic boolean containsReference()
SecurityTokenReference contains
a wsse:Reference elementpublic int lengthReference()
wsse:Reference elements in
the SecurityTokenReferencepublic boolean containsX509IssuerSerial()
SecurityTokenReference contains
a ds:IssuerSerial elementpublic boolean containsX509Data()
SecurityTokenReference contains
a ds:X509Data elementpublic int lengthX509IssuerSerial()
ds:IssuerSerial elements in
the SecurityTokenReferencepublic int lengthX509Data()
ds:IssuerSerial elements in
the SecurityTokenReferencepublic boolean containsKeyIdentifier()
SecurityTokenReference contains
a wsse:KeyIdentifier elementpublic int lengthKeyIdentifier()
wsse:KeyIdentifier elements in
the SecurityTokenReferencepublic int length(String namespace, String localname)
namespace - localname - public Element getElement()
public void setID(String id)
id - public String getID()
public String toString()
Copyright © 2004–2015 The Apache Software Foundation. All rights reserved.