Class SecureSOAPMessage
- java.lang.Object
-
- com.sun.identity.wss.security.handler.SecureSOAPMessage
-
public class SecureSOAPMessage extends Object
This classSecureSOAPMessageconstructs the securedSOAPMessagefor the given security mechanism token.
-
-
Constructor Summary
Constructors Constructor Description SecureSOAPMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean create)Constructor to create secure SOAP message.SecureSOAPMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean create, List signedElements)Constructor to create secure SOAP message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecrypt(String keyAlias, boolean decryptBody, boolean decryptHeader)Decrypts theSOAPMessagefor the given security profile.voidencrypt(String certAlias, String encryptionAlgorithm, int encryptionKeyStrength, boolean encryptBody, boolean encryptHeader)Encrypts theSOAPMessagefor the given security profile.StringgetClientDnsClaim()X509CertificategetMessageCertificate()Returns theX509Certificatethat is used to secure theSOAPMessage.StringgetMessageID()Returns the messageID from the<wsa:Addressing>header.longgetMessageTimestamp()Retruns the message timestamp.SecurityContextgetSecurityContext()ElementgetSecurityHeaderElement()Returns the Security Header Element.SecurityMechanismgetSecurityMechanism()Returns the security mechanism of the secure soap message.SecurityTokengetSecurityToken()Returns the security token associated with this secure soap message.jakarta.xml.soap.SOAPMessagegetSOAPMessage()Returns the secured SOAP message.voidparseSecurityHeader(Node node)Parses for the security header.voidsetSecurityContext(SecurityContext securityContext)voidsetSecurityMechanism(SecurityMechanism securityMechanism)Sets the security mechanism for securing the soap message.voidsetSecurityToken(SecurityToken token)Sets the security token for securing the soap message.voidsetSenderIdentity(String dnsName)voidsetSignedElements(List elements)voidsetSOAPMessage(jakarta.xml.soap.SOAPMessage inSoapMessage)Sets the secured SOAP message.voidsign()Signs theSOAPMessagefor the given security profile.booleanverifyKerberosTokenSignature(Key secretKey)Verifies the signature of the SOAP message that has kerberos key.booleanverifySignature()Verifies the signature of the SOAP message.
-
-
-
Constructor Detail
-
SecureSOAPMessage
public SecureSOAPMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean create) throws SecurityExceptionConstructor to create secure SOAP message.- Parameters:
soapMessage- the SOAP message to be secured.create- if true, creates a new secured SOAP message by adding security headers. if false, parses the secured SOAP message.- Throws:
SecurityException- if failed in creating or parsing the new secured SOAP message.
-
SecureSOAPMessage
public SecureSOAPMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean create, List signedElements) throws SecurityExceptionConstructor to create secure SOAP message.- Parameters:
soapMessage- the SOAP message to be secured.create- if true, creates a new secured SOAP message by adding security headers. if false, parses the secured SOAP message.signedElements- list of signed elements- Throws:
SecurityException- if failed in creating or parsing the new secured SOAP message.
-
-
Method Detail
-
getSecurityHeaderElement
public Element getSecurityHeaderElement()
Returns the Security Header Element.- Returns:
- the Security Header Element.
-
getSOAPMessage
public jakarta.xml.soap.SOAPMessage getSOAPMessage()
Returns the secured SOAP message.- Returns:
- the secured SOAP message.
-
setSOAPMessage
public void setSOAPMessage(jakarta.xml.soap.SOAPMessage inSoapMessage)
Sets the secured SOAP message.- Parameters:
inSoapMessage- the input secured SOAP message.
-
parseSecurityHeader
public void parseSecurityHeader(Node node) throws SecurityException
Parses for the security header.- Parameters:
node- security header node.- Throws:
SecurityException- if there is any error occured.
-
getSecurityMechanism
public SecurityMechanism getSecurityMechanism()
Returns the security mechanism of the secure soap message.- Returns:
- SecurityMechanism the security mechanism of the secure
SOAPMessage.
-
setSecurityMechanism
public void setSecurityMechanism(SecurityMechanism securityMechanism)
Sets the security mechanism for securing the soap message.- Parameters:
securityMechanism- the security mechanism that will be used to secure the soap message.
-
setSecurityToken
public void setSecurityToken(SecurityToken token) throws SecurityException
Sets the security token for securing the soap message.- Parameters:
token- the security token that is used to secure the soap message.- Throws:
SecurityException- if the security token can not be added to the security header.
-
getSecurityToken
public SecurityToken getSecurityToken()
Returns the security token associated with this secure soap message.- Returns:
- SecurityToken the security token for this secure soap message.
-
getSecurityContext
public SecurityContext getSecurityContext()
-
setSecurityContext
public void setSecurityContext(SecurityContext securityContext)
-
sign
public void sign() throws SecurityExceptionSigns theSOAPMessagefor the given security profile.- Throws:
SecurityException- if there is any failure in signing.
-
getMessageID
public String getMessageID()
Returns the messageID from the<wsa:Addressing>header.- Returns:
- the messageID from the
<wsa:Addressing>header.
-
getMessageTimestamp
public long getMessageTimestamp()
Retruns the message timestamp.- Returns:
- the message timestamp.
-
verifySignature
public boolean verifySignature() throws SecurityExceptionVerifies the signature of the SOAP message.- Returns:
- true if the signature verification is successful.
- Throws:
SecurityException- if there is any failure in validation.
-
verifyKerberosTokenSignature
public boolean verifyKerberosTokenSignature(Key secretKey) throws SecurityException
Verifies the signature of the SOAP message that has kerberos key.- Parameters:
secretKey- the secret key that is used for signature verification.- Returns:
- true if the signature verification is successful.
- Throws:
SecurityException- if there is any failure in validation.
-
getMessageCertificate
public X509Certificate getMessageCertificate()
Returns theX509Certificatethat is used to secure theSOAPMessage.- Returns:
- the X509 certificate.
-
encrypt
public void encrypt(String certAlias, String encryptionAlgorithm, int encryptionKeyStrength, boolean encryptBody, boolean encryptHeader) throws SecurityException
Encrypts theSOAPMessagefor the given security profile.- Parameters:
certAlias- the certificate aliasencryptBody- boolean flag to encrypt BodyencryptHeader- boolean flag to encrypt Security header- Throws:
SecurityException- if there is any failure in encryption.
-
decrypt
public void decrypt(String keyAlias, boolean decryptBody, boolean decryptHeader) throws SecurityException
Decrypts theSOAPMessagefor the given security profile.- Parameters:
keyAlias- private key alias that is used to decrypt.decryptBody- boolean flag to decrypt BodydecryptHeader- boolean flag to decrypt Security header- Throws:
SecurityException- if there is any failure in decryption.
-
setSenderIdentity
public void setSenderIdentity(String dnsName)
-
getClientDnsClaim
public String getClientDnsClaim()
-
setSignedElements
public void setSignedElements(List elements)
-
-