Class UsernameTokenHeader
- java.lang.Object
-
- com.sun.xml.ws.security.opt.impl.incoming.UsernameTokenHeader
-
- All Implemented Interfaces:
NamespaceContextInfo,PolicyBuilder,SecurityElement,SecurityElementWriter,SecurityHeaderElement,UsernameToken,TokenValidator
public class UsernameTokenHeader extends Object implements UsernameToken, SecurityHeaderElement, TokenValidator, PolicyBuilder, NamespaceContextInfo, SecurityElementWriter
- Author:
- Ashutosh.Shahi@sun.com
-
-
Constructor Summary
Constructors Constructor Description UsernameTokenHeader(XMLStreamReader reader, com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator creator, HashMap nsDecls, XMLInputFactory staxIF)Creates a new instance of UsernameTokenHeader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetId()HashMap<String,String>getInscopeNSContext()map of all inscope namespace declarations.StringgetIterations()StringgetLocalPart()Gets the local name of this header element.StringgetNamespaceURI()StringgetPasswordValue()WSSPolicygetPolicy()returns theWSSPolicythat was created for the SecurityHeaderElementStringgetSalt()StringgetUsernameValue()XMLStreamReaderreadHeader()Reads the header as aXMLStreamReader.booleanrefersToSecHdrWithId(String id)voidsetId(String id)voidsetIterations(int iterate)voidsetPasswordValue(String passwd)sets the password value for this tokenvoidsetSalt(String receivedSalt)voidsetUsernameValue(String username)sets the username value for this tokenvoidvalidate(ProcessingContext context)Peforms token validation , eg: In case BinarySecurityToken checks if the token is valid.voidwriteTo(OutputStream os)voidwriteTo(XMLStreamWriter streamWriter)Writes out the header.voidwriteTo(XMLStreamWriter streamWriter, HashMap props)
-
-
-
Constructor Detail
-
UsernameTokenHeader
public UsernameTokenHeader(XMLStreamReader reader, com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator creator, HashMap nsDecls, XMLInputFactory staxIF) throws XMLStreamException, com.sun.xml.stream.buffer.XMLStreamBufferException
Creates a new instance of UsernameTokenHeader- Throws:
XMLStreamExceptioncom.sun.xml.stream.buffer.XMLStreamBufferException
-
-
Method Detail
-
validate
public void validate(ProcessingContext context) throws com.sun.xml.wss.XWSSecurityException
Description copied from interface:TokenValidatorPeforms token validation , eg: In case BinarySecurityToken checks if the token is valid.- Specified by:
validatein interfaceTokenValidator- Throws:
com.sun.xml.wss.XWSSecurityException
-
getPolicy
public WSSPolicy getPolicy()
Description copied from interface:PolicyBuilderreturns theWSSPolicythat was created for the SecurityHeaderElement- Specified by:
getPolicyin interfacePolicyBuilder- Returns:
WSSPolicy
-
refersToSecHdrWithId
public boolean refersToSecHdrWithId(String id)
- Specified by:
refersToSecHdrWithIdin interfaceSecurityHeaderElement- Returns:
-
getId
public String getId()
- Specified by:
getIdin interfaceSecurityElement- Returns:
- id
-
setId
public void setId(String id)
- Specified by:
setIdin interfaceSecurityElement
-
getNamespaceURI
public String getNamespaceURI()
- Specified by:
getNamespaceURIin interfaceSecurityElement- Returns:
- namespace uri of the security header element.
-
getLocalPart
public String getLocalPart()
Description copied from interface:SecurityElementGets the local name of this header element.- Specified by:
getLocalPartin interfaceSecurityElement- Returns:
- this string must be interned.
-
readHeader
public XMLStreamReader readHeader() throws XMLStreamException
Description copied from interface:SecurityElementReads the header as aXMLStreamReader.The returned parser points at the start element of this header. (IOW,
XMLStreamReader.getEventType()would returnXMLStreamConstants.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:
readHeaderin interfaceSecurityElement- Returns:
- must not null.
- Throws:
XMLStreamException
-
writeTo
public void writeTo(OutputStream os)
- Specified by:
writeToin interfaceSecurityElementWriter
-
writeTo
public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException
Description copied from interface:SecurityElementWriterWrites out the header.- Specified by:
writeToin interfaceSecurityElementWriter- Throws:
XMLStreamException- if the operation fails for some reason. This leaves the writer to an undefined state.
-
getUsernameValue
public String getUsernameValue()
- Specified by:
getUsernameValuein interfaceUsernameToken- Returns:
- the username value
-
setUsernameValue
public void setUsernameValue(String username)
Description copied from interface:UsernameTokensets the username value for this token- Specified by:
setUsernameValuein interfaceUsernameToken- Parameters:
username- username value
-
getPasswordValue
public String getPasswordValue()
- Specified by:
getPasswordValuein interfaceUsernameToken- Returns:
- the password for this token
-
setPasswordValue
public void setPasswordValue(String passwd)
Description copied from interface:UsernameTokensets the password value for this token- Specified by:
setPasswordValuein interfaceUsernameToken- Parameters:
passwd- the password value
-
setSalt
public void setSalt(String receivedSalt)
-
getSalt
public String getSalt()
-
setIterations
public void setIterations(int iterate)
-
getIterations
public String getIterations()
-
getInscopeNSContext
public HashMap<String,String> getInscopeNSContext()
Description copied from interface:NamespaceContextInfomap of all inscope namespace declarations.- Specified by:
getInscopeNSContextin interfaceNamespaceContextInfo- Returns:
HashMapof all inscope namespaces.
-
writeTo
public void writeTo(XMLStreamWriter streamWriter, HashMap props) throws XMLStreamException
- Specified by:
writeToin interfaceSecurityElementWriter- Throws:
XMLStreamException
-
-