com.sun.xml.ws.security.opt.impl.keyinfo
Class SecurityTokenReference

java.lang.Object
  extended by com.sun.xml.ws.security.secext10.SecurityTokenReferenceType
      extended by com.sun.xml.ws.security.opt.impl.keyinfo.SecurityTokenReference
All Implemented Interfaces:
SecurityTokenReference, SecurityElement, SecurityElementWriter, SecurityHeaderElement, Token

public class SecurityTokenReference
extends SecurityTokenReferenceType
implements SecurityTokenReference, SecurityHeaderElement, SecurityElementWriter, Token

Author:
Ashutosh.Shahi@sun.com

Field Summary
 
Fields inherited from class com.sun.xml.ws.security.secext10.SecurityTokenReferenceType
any, id, usage
 
Fields inherited from interface com.sun.xml.ws.security.opt.api.keyinfo.SecurityTokenReference
DIRECT_REFERENCE, KEYIDENTIFIER, REFERENCE, X509DATA_ISSUERSERIAL
 
Constructor Summary
SecurityTokenReference(SOAPVersion soapVersion)
          Creates a new instance of SecurityTokenReference
 
Method Summary
 byte[] canonicalize(String algorithm, List<AttributeNS> namespaceDecls)
           
 String getAttribute(QName name)
           
 String getAttribute(String nsUri, String localName)
           
 String getLocalPart()
          Gets the local name of this header element.
 String getNamespaceURI()
           
 Reference getReference()
          gets the reference element from the security token reference
 String getTokenType()
          get the WSS 1.1 Token type for SecurityTokenRerference
 Object getTokenValue()
          The token Value
 String getType()
          The type of the Token
 boolean isCanonicalized()
           
 XMLStreamReader readHeader()
          Reads the header as a XMLStreamReader.
 boolean refersToSecHdrWithId(String id)
          checks whether this element refers to the security header element with the given id
 void setReference(Reference ref)
          sets the reference element into the security token reference
 void setTokenType(String tokenType)
          set the WSS 1.1 Token type for SecurityTokenRerference
 void writeTo(OutputStream os)
           
 void writeTo(XMLStreamWriter streamWriter)
          writes the SecurityTokenReference element to the XMLStreamWriter
 void writeTo(XMLStreamWriter streamWriter, HashMap props)
          writes the SecurityTokenReference element to the XMLStreamWriter
 
Methods inherited from class com.sun.xml.ws.security.secext10.SecurityTokenReferenceType
getAny, getId, getOtherAttributes, getUsage, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.ws.security.opt.api.keyinfo.Token
getId
 
Methods inherited from interface com.sun.xml.ws.security.opt.api.SecurityElement
getId, setId
 

Constructor Detail

SecurityTokenReference

public SecurityTokenReference(SOAPVersion soapVersion)
Creates a new instance of SecurityTokenReference

Method Detail

setReference

public void setReference(Reference ref)
sets the reference element into the security token reference

Specified by:
setReference in interface SecurityTokenReference
Parameters:
ref - Reference

getReference

public Reference getReference()
gets the reference element from the security token reference

Specified by:
getReference in interface SecurityTokenReference
Returns:

setTokenType

public void setTokenType(String tokenType)
Description copied from interface: SecurityTokenReference
set the WSS 1.1 Token type for SecurityTokenRerference

Specified by:
setTokenType in interface SecurityTokenReference
Parameters:
tokenType - the value of TokenType attribute used in WSS 1.1

getTokenType

public String getTokenType()
Description copied from interface: SecurityTokenReference
get the WSS 1.1 Token type for SecurityTokenRerference

Specified by:
getTokenType in interface SecurityTokenReference
Returns:
the value of TokenType attribute used in WSS 1.1

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface SecurityElement
Returns:
namespace uri of the security header element.

getLocalPart

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

Specified by:
getLocalPart in interface SecurityElement
Returns:
this string must be interned.

getAttribute

public String getAttribute(@NotNull
                           String nsUri,
                           @NotNull
                           String localName)

getAttribute

public String getAttribute(@NotNull
                           QName name)

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
Returns:
must not null.
Throws:
XMLStreamException

writeTo

public void writeTo(XMLStreamWriter streamWriter)
             throws XMLStreamException
writes the SecurityTokenReference element to the XMLStreamWriter

Specified by:
writeTo in interface SecurityElementWriter
Parameters:
streamWriter -
Throws:
XMLStreamException

canonicalize

public byte[] canonicalize(String algorithm,
                           List<AttributeNS> namespaceDecls)

isCanonicalized

public boolean isCanonicalized()

writeTo

public void writeTo(OutputStream os)
Specified by:
writeTo in interface SecurityElementWriter

refersToSecHdrWithId

public boolean refersToSecHdrWithId(String id)
checks whether this element refers to the security header element with the given id

Specified by:
refersToSecHdrWithId in interface SecurityHeaderElement
Parameters:
id -
Returns:

writeTo

public void writeTo(XMLStreamWriter streamWriter,
                    HashMap props)
             throws XMLStreamException
writes the SecurityTokenReference element to the XMLStreamWriter

Specified by:
writeTo in interface SecurityElementWriter
Parameters:
streamWriter -
props -
Throws:
XMLStreamException

getType

public String getType()
Description copied from interface: Token
The type of the Token

Specified by:
getType in interface Token

getTokenValue

public Object getTokenValue()
Description copied from interface: Token
The token Value

Specified by:
getTokenValue in interface Token


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