Class UsernameToken
- java.lang.Object
-
- com.sun.xml.ws.security.secext10.UsernameTokenType
-
- com.sun.xml.ws.security.opt.impl.tokens.UsernameToken
-
- All Implemented Interfaces:
SecurityElement,SecurityElementWriter,SecurityHeaderElement,UsernameToken
public class UsernameToken extends com.sun.xml.ws.security.secext10.UsernameTokenType implements UsernameToken, SecurityHeaderElement, SecurityElementWriter
Representation of UsernameToken SecurityHeaderElement- Author:
- Ashutosh.Shahi@sun.com
-
-
Field Summary
Fields Modifier and Type Field Description static longMAX_NONCE_AGE
-
Constructor Summary
Constructors Constructor Description UsernameToken(com.sun.xml.ws.api.SOAPVersion sv)Creates a new instance of UsernameToken
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttribute(String nsUri, String localName)StringgetAttribute(QName name)StringgetCreatedValue()Returns the created which may be null meaning no time of creation.StringgetLocalPart()Gets the local name of this header element.StringgetNamespaceURI()StringgetNonceEncodingType()StringgetNonceValue()StringgetPasswordDigestValue()StringgetPasswordType()StringgetPasswordValue()StringgetUsernameValue()booleanisBSP()voidisBSP(boolean flag)XMLStreamReaderreadHeader()Reads the header as aXMLStreamReader.booleanrefersToSecHdrWithId(String id)voidsetCreationTime(String time)set the creation time.voidsetDigestOn()voidsetNonce(String nonceValue)set the nonce value.If nonce value is null then it will create one.voidsetPasswordValue(String passwd)Sets the password.voidsetUsernameValue(String username)sets the username value for this tokenvoidwriteTo(OutputStream os)voidwriteTo(XMLStreamWriter streamWriter)Writes out the header.voidwriteTo(XMLStreamWriter streamWriter, HashMap props)-
Methods inherited from class com.sun.xml.ws.security.secext10.UsernameTokenType
getAny, getCreated, getId, getIteration, getNonce, getOtherAttributes, getPassword, getSalt, getUsername, setCreated, setId, setIteration, setNonce, setPassword, setSalt, setUsername
-
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.SecurityElement
getId, setId
-
-
-
-
Field Detail
-
MAX_NONCE_AGE
public static final long MAX_NONCE_AGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUsernameValue
public String getUsernameValue()
- Specified by:
getUsernameValuein interfaceUsernameToken- Returns:
- Returns the username.
-
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:
- Returns the password which may be null meaning no password.
-
setPasswordValue
public void setPasswordValue(String passwd)
Sets the password.- Specified by:
setPasswordValuein interfaceUsernameToken- Parameters:
passwd-
-
getPasswordType
public String getPasswordType()
- Returns:
- Returns the passwordType.
-
getNonceEncodingType
public String getNonceEncodingType()
- Returns:
- Returns the Nonce Encoding type.
-
getNonceValue
public String getNonceValue() throws SecurityTokenException
- Returns:
- Returns the encoded nonce. Null indicates no nonce was set.
- Throws:
SecurityTokenException
-
getCreatedValue
public String getCreatedValue()
Returns the created which may be null meaning no time of creation.
-
getPasswordDigestValue
public String getPasswordDigestValue()
-
setNonce
public void setNonce(String nonceValue)
set the nonce value.If nonce value is null then it will create one.- Parameters:
nonceValue-
-
setCreationTime
public void setCreationTime(String time) throws com.sun.xml.wss.XWSSecurityException
set the creation time.- Parameters:
time- If null or empty then this method would create one.- Throws:
com.sun.xml.wss.XWSSecurityException
-
setDigestOn
public void setDigestOn() throws SecurityTokenException- Throws:
SecurityTokenException
-
isBSP
public void isBSP(boolean flag)
-
isBSP
public boolean isBSP()
-
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.
-
refersToSecHdrWithId
public boolean refersToSecHdrWithId(String id)
- Specified by:
refersToSecHdrWithIdin interfaceSecurityHeaderElement- Parameters:
id-- Returns:
-
writeTo
public void writeTo(XMLStreamWriter streamWriter, HashMap props) throws XMLStreamException
- Specified by:
writeToin interfaceSecurityElementWriter- Throws:
XMLStreamException
-
-