org.apache.ws.security.saml
Class WSSecSignatureSAML

java.lang.Object
  extended byorg.apache.ws.security.message.WSSecBase
      extended byorg.apache.ws.security.message.WSSecSignature
          extended byorg.apache.ws.security.saml.WSSecSignatureSAML

public class WSSecSignatureSAML
extends WSSecSignature


Field Summary
 
Fields inherited from class org.apache.ws.security.message.WSSecSignature
bstToken, canonAlgo, certUri, document, keyInfo, keyInfoUri, secRef, sig, sigAlgo, signatureValue, strUri, usernameToken, useSingleCert, wsDocInfo
 
Fields inherited from class org.apache.ws.security.message.WSSecBase
doDebug, keyIdentifierType, parts, password, user, wssConfig
 
Constructor Summary
WSSecSignatureSAML()
          Constructor.
 
Method Summary
 void addReferencesToSign(java.util.Vector references, WSSecHeader secHeader)
          This method adds references to the Signature.
 org.w3c.dom.Document build(org.w3c.dom.Document doc, Crypto uCrypto, org.opensaml.SAMLAssertion assertion, Crypto iCrypto, java.lang.String iKeyName, java.lang.String iKeyPW, WSSecHeader secHeader)
          Builds a signed soap envelope with SAML token.
 void computeSignature()
          Compute the Signature over the references.
 void prepare(org.w3c.dom.Document doc, Crypto uCrypto, org.opensaml.SAMLAssertion assertion, Crypto iCrypto, java.lang.String iKeyName, java.lang.String iKeyPW, WSSecHeader secHeader)
          Initialize a WSSec SAML Signature.
 void prependSAMLElementsToHeader(WSSecHeader secHeader)
          Prepend the SAML elements to the elements already in the Security header.
 
Methods inherited from class org.apache.ws.security.message.WSSecSignature
appendBSTElementToHeader, appendToHeader, build, createSTRParameter, getBinarySecurityTokenElement, getBSTTokenId, getDigestAlgo, getId, getInclusivePrefixes, getInclusivePrefixes, getSigCanonicalization, getSignatureAlgorithm, getSignatureElement, getSignatureValue, isUseSingleCertificate, prepare, prependBSTElementToHeader, prependToHeader, setCustomTokenId, setCustomTokenValueType, setDigestAlgo, setEncrKeySha1value, setSecretKey, setSigCanonicalization, setSignatureAlgorithm, setUsernameToken, setUseSingleCertificate
 
Methods inherited from class org.apache.ws.security.message.WSSecBase
getKeyIdentifierType, setBodyID, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSSecSignatureSAML

public WSSecSignatureSAML()
Constructor.

Method Detail

build

public org.w3c.dom.Document build(org.w3c.dom.Document doc,
                                  Crypto uCrypto,
                                  org.opensaml.SAMLAssertion assertion,
                                  Crypto iCrypto,
                                  java.lang.String iKeyName,
                                  java.lang.String iKeyPW,
                                  WSSecHeader secHeader)
                           throws WSSecurityException
Builds a signed soap envelope with SAML token.

The method first gets an appropriate security header. According to the defined parameters for certificate handling the signature elements are constructed and inserted into the wsse:Signature

Parameters:
doc - The unsigned SOAP envelope as Document
uCrypto - The user's Crypto instance
assertion - the complete SAML assertion
iCrypto - An instance of the Crypto API to handle keystore SAML token issuer and to generate certificates
iKeyName - Private key to use in case of "sender-Vouches"
iKeyPW - Password for issuer private key
secHeader - The Security header
Returns:
A signed SOAP envelope as Document
Throws:
WSSecurityException

prepare

public void prepare(org.w3c.dom.Document doc,
                    Crypto uCrypto,
                    org.opensaml.SAMLAssertion assertion,
                    Crypto iCrypto,
                    java.lang.String iKeyName,
                    java.lang.String iKeyPW,
                    WSSecHeader secHeader)
             throws WSSecurityException
Initialize a WSSec SAML Signature. The method sets up and initializes a WSSec SAML Signature structure after the relevant information was set. After setup of the references to elements to sign may be added. After all references are added they can be signed.

This method does not add the Signature element to the security header. See prependSignatureElementToHeader() method.

Parameters:
doc - The SOAP envelope as Document
uCrypto - The user's Crypto instance
assertion - the complete SAML assertion
iCrypto - An instance of the Crypto API to handle keystore SAML token issuer and to generate certificates
iKeyName - Private key to use in case of "sender-Vouches"
iKeyPW - Password for issuer private key
secHeader - The Security header
Throws:
WSSecurityException

prependSAMLElementsToHeader

public void prependSAMLElementsToHeader(WSSecHeader secHeader)
Prepend the SAML elements to the elements already in the Security header. The method can be called any time after prepare(). This allows to insert the SAML elements at any position in the Security header.

This methods first prepends the SAML security reference if mode is senderVouches, then the SAML token itself,

Parameters:
secHeader - The security header that holds the BST element.

addReferencesToSign

public void addReferencesToSign(java.util.Vector references,
                                WSSecHeader secHeader)
                         throws WSSecurityException
This method adds references to the Signature. The added references are signed when calling computeSignature(). This method can be called several times to add references as required. addReferencesToSign() can be called anytime after prepare.

Overrides:
addReferencesToSign in class WSSecSignature
Parameters:
references - A vector containing WSEncryptionPart objects that define the parts to sign.
secHeader - Used to compute namespaces to be inserted by InclusiveNamespaces to be WSI compliant.
Throws:
WSSecurityException

computeSignature

public void computeSignature()
                      throws WSSecurityException
Compute the Signature over the references. After references are set this method computes the Signature for them. This method can be called anytime after the references were set. See addReferencesToSign().

Overrides:
computeSignature in class WSSecSignature
Throws:
WSSecurityException


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.