|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.systinet.wasp.security.ws.ReferrableElement
org.systinet.wasp.security.ws.SecurityElement
org.systinet.wasp.security.ws.Signature
Represents signature.
To sign a message part, you need to create a token for signing and initialize
Signature
instance using that token. Then you may add references
to message part(s), or specify that message body is to be signed
by calling setSignBody()
method.
Default values
signature method:
http://www.w3.org/2000/09/xmldsig#hmac-sha1
UsernameToken
or SharedSecretToken
.
http://www.w3.org/2000/09/xmldsig#rsa-sha1
http://www.w3.org/2000/09/xmldsig#dsa-sha1
X509Token
.
http://www.w3.org/2001/10/xml-exc-c14n#
http://www.w3.org/2000/09/xmldsig#sha1
wsse:SecurityTokenReference/wsse:Reference
Examples
Signing message body:
// create service client instance ServiceClient serviceClient = ServiceClient.create("http://..."); // authenticate client and set the credentials Credentials creds = WaspSecurity.acquireClientCredentials("Chris", "sirhC", "WS-Security"); WaspSecurity.setCredentials(serviceClient, new Credentials[]{creds}); WaspSecurity.setInitiatingProvider(serviceClient, "WS-Security"); // create service proxy ServiceSoap svc = (ServiceSoap) serviceClient.createProxy(ServiceSoap.class); // create new call security configuration MessageSecurity ms = new MessageSecurity(); // create signing token X509Token signingX509token = new X509Token(); // add the token to message security ms.addToken(signingX509token); // create new signature Signature sig = new Signature(signingX509token); // set body signing sig.setSignBody(); // add the signature to message security ms.addSecurityElement(sig); // set call security ms.setCallSecurity(serviceClient); // invoke service method svc.ping("EchoString");
UsernameToken
,
X509Token
,
SharedSecretToken
,
MessageSecurity
Constructor Summary | |
Signature(SecurityToken token)
Initializes a new signature with the specified signing token. |
|
Signature(SecurityToken token,
UriReference reference)
Initializes a new signature with the specified signing token and resource reference to be signed. |
Method Summary | |
void |
addReference(UriReference reference)
Adds a reference to a resource to be included in the signature. |
void |
setCanonicalizationMethod(java.lang.String canonicalizationMethod)
Sets canonicalization method. |
void |
setSecurityTokenReferenceId(java.lang.String strId)
Sets value of the wsu:Id set on the SecurityTokenReference subelement of the tag
Signature/KeyInfo . |
void |
setSignBody()
Instructs the signature to sign message body. |
Methods inherited from class org.systinet.wasp.security.ws.SecurityElement |
getToken |
Methods inherited from class org.systinet.wasp.security.ws.ReferrableElement |
getId, getIdForced, setId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Signature(SecurityToken token)
token
- tokenpublic Signature(SecurityToken token, UriReference reference)
Signature sig = new Signature(token); sig.addReference(new UriReference("..."));
token
- tokenMethod Detail |
public void addReference(UriReference reference)
reference
- resource referencepublic void setSignBody()
public void setCanonicalizationMethod(java.lang.String canonicalizationMethod)
Constants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS
Constants.ALGO_ID_C14N_EXCL_WITH_COMMENTS
Constants.ALGO_ID_C14N_OMIT_COMMENTS
Constants.ALGO_ID_C14N_WITH_COMMENTS
canonicalizationMethod
- canonicalization methodpublic void setSecurityTokenReferenceId(java.lang.String strId)
wsu:Id
set on the SecurityTokenReference
subelement of the tag
Signature/KeyInfo
.
strId
- the wsu:Id
attribute value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |