com.sun.xml.ws.security.opt.impl.dsig
Class SignedMessageHeader

java.lang.Object
  extended by com.sun.xml.ws.security.opt.impl.dsig.SignedMessagePart
      extended by com.sun.xml.ws.security.opt.impl.dsig.SignedMessageHeader
All Implemented Interfaces:
SecurityElement, SecurityElementWriter, SecurityHeaderElement, SignedData
Direct Known Subclasses:
EncryptedSignedMessageHeader

public class SignedMessageHeader
extends SignedMessagePart
implements SecurityHeaderElement, SignedData, SecurityElementWriter

A wrapper over a Header or a SecurityHeaderElement

Author:
K.Venugopal@sun.com

Field Summary
 
Fields inherited from class com.sun.xml.ws.security.opt.impl.dsig.SignedMessagePart
isCanonicalized
 
Constructor Summary
SignedMessageHeader(Header header, String id, JAXBFilterProcessingContext context)
          Creates a new instance of SignedMessageHeader
SignedMessageHeader(SecurityHeaderElement she)
          Sign a SecurityHeaderElement
 
Method Summary
 byte[] getDigestValue()
           
 String getId()
           
 String getLocalPart()
          Gets the local name of this header element.
 String getNamespaceURI()
           
 Header getSignedHeader()
           
 XMLStreamReader readHeader()
          Reads the header as a XMLStreamReader.
 boolean refersToSecHdrWithId(String id)
           
 void setDigestValue(byte[] digestValue)
           
 void setId(String id)
          Assign an id to the SignedMessageHeader
 void writeTo(OutputStream os)
          Write the header to the passed outputStream
 void writeTo(XMLStreamWriter streamWriter)
          Write the header to an XMLStreamWriter
 void writeTo(XMLStreamWriter streamWriter, HashMap props)
          Write the header to an XMLStreamWriter
 
Methods inherited from class com.sun.xml.ws.security.opt.impl.dsig.SignedMessagePart
getAttributeValuePrefixes, writeCanonicalized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedMessageHeader

public SignedMessageHeader(Header header,
                           String id,
                           JAXBFilterProcessingContext context)
Creates a new instance of SignedMessageHeader

Parameters:
header - The SOAP Header which is to be signed
id - The id assigned to the SOAP header
context - JAXBFilterProcessingContext

SignedMessageHeader

public SignedMessageHeader(SecurityHeaderElement she)
Sign a SecurityHeaderElement

Parameters:
she - The SecurityHeaderElement to be signed
Method Detail

getId

public String getId()
Specified by:
getId in interface SecurityElement
Overrides:
getId in class SignedMessagePart
Returns:
the id of the SignedMessageHeader

setId

public void setId(String id)
Assign an id to the SignedMessageHeader

Specified by:
setId in interface SecurityElement
Overrides:
setId in class SignedMessagePart

getNamespaceURI

@NotNull
public String getNamespaceURI()
Specified by:
getNamespaceURI in interface SecurityElement
Overrides:
getNamespaceURI in class SignedMessagePart
Returns:
the namespace of the underlying SOAP header or SecurityHeaderElement

getLocalPart

@NotNull
public String getLocalPart()
Description copied from interface: SecurityElement
Gets the local name of this header element.

Specified by:
getLocalPart in interface SecurityElement
Overrides:
getLocalPart in class SignedMessagePart
Returns:
The localname of the underlying SOAP Header or SecurityHeaderElement

readHeader

public XMLStreamReader readHeader()
                           throws XMLStreamException
Description copied from interface: SecurityElement
Reads the header as a XMLStreamReader.

The returned parser points at the start element of this header. (IOW, XMLStreamReader.getEventType() would return XMLStreamConstants.START_ELEMENT.

Performance Expectation

For some Header implementations, this operation is a non-trivial operation. Therefore, use of this method is discouraged unless the caller is interested in reading the whole header.

Similarly, if the caller wants to use this method only to do the API conversion (such as simply firing SAX events from XMLStreamReader), then the JAX-WS team requests that you talk to us.

Messages that come from tranport usually provides a reasonably efficient implementation of this method.

Specified by:
readHeader in interface SecurityElement
Overrides:
readHeader in class SignedMessagePart
Returns:
The header as as XMLStreamReader
Throws:
XMLStreamException

writeTo

public void writeTo(OutputStream os)
Write the header to the passed outputStream

Specified by:
writeTo in interface SecurityElementWriter
Overrides:
writeTo in class SignedMessagePart

writeTo

public void writeTo(XMLStreamWriter streamWriter)
             throws XMLStreamException
Write the header to an XMLStreamWriter

Specified by:
writeTo in interface SecurityElementWriter
Overrides:
writeTo in class SignedMessagePart
Throws:
XMLStreamException - if the operation fails for some reason. This leaves the writer to an undefined state.

writeTo

public void writeTo(XMLStreamWriter streamWriter,
                    HashMap props)
             throws XMLStreamException
Write the header to an XMLStreamWriter

Specified by:
writeTo in interface SecurityElementWriter
Overrides:
writeTo in class SignedMessagePart
Throws:
XMLStreamException

setDigestValue

public void setDigestValue(byte[] digestValue)
Specified by:
setDigestValue in interface SignedData
Overrides:
setDigestValue in class SignedMessagePart

getDigestValue

public byte[] getDigestValue()
Specified by:
getDigestValue in interface SignedData
Overrides:
getDigestValue in class SignedMessagePart
Returns:
The DigestValue of this Header

refersToSecHdrWithId

public boolean refersToSecHdrWithId(String id)
Specified by:
refersToSecHdrWithId in interface SecurityHeaderElement
Parameters:
id - The id of the SecurityHeaderElement against which to compare
Returns:
true if the current SecurityHeaderElement has reference to the SecurityHeaderElement with passed id

getSignedHeader

public Header getSignedHeader()


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.