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 UsernameTokenType implements UsernameToken, SecurityHeaderElement, SecurityElementWriter
Representation of UsernameToken SecurityHeaderElement- Author:
- [email protected]
-
-
Field Summary
Fields Modifier and Type Field Description static long
MAX_NONCE_AGE
-
Constructor Summary
Constructors Constructor Description UsernameToken(SOAPVersion sv)
Creates a new instance of UsernameToken
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAttribute(String nsUri, String localName)
String
getAttribute(QName name)
String
getCreatedValue()
Returns the created which may be null meaning no time of creation.String
getLocalPart()
Gets the local name of this header element.String
getNamespaceURI()
String
getNonceEncodingType()
String
getNonceValue()
String
getPasswordDigestValue()
String
getPasswordType()
String
getPasswordValue()
String
getUsernameValue()
boolean
isBSP()
void
isBSP(boolean flag)
XMLStreamReader
readHeader()
Reads the header as aXMLStreamReader
.boolean
refersToSecHdrWithId(String id)
void
setCreationTime(String time)
set the creation time.void
setDigestOn()
void
setNonce(String nonceValue)
set the nonce value.If nonce value is null then it will create one.void
setPasswordValue(String passwd)
Sets the password.void
setUsernameValue(String username)
sets the username value for this tokenvoid
writeTo(OutputStream os)
void
writeTo(XMLStreamWriter streamWriter)
Writes out the header.void
writeTo(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
-
-
Constructor Detail
-
UsernameToken
public UsernameToken(SOAPVersion sv)
Creates a new instance of UsernameToken
-
-
Method Detail
-
getUsernameValue
public String getUsernameValue()
- Specified by:
getUsernameValue
in interfaceUsernameToken
- Returns:
- Returns the username.
-
setUsernameValue
public void setUsernameValue(String username)
Description copied from interface:UsernameToken
sets the username value for this token- Specified by:
setUsernameValue
in interfaceUsernameToken
- Parameters:
username
- username value
-
getPasswordValue
public String getPasswordValue()
- Specified by:
getPasswordValue
in interfaceUsernameToken
- Returns:
- Returns the password which may be null meaning no password.
-
setPasswordValue
public void setPasswordValue(String passwd)
Sets the password.- Specified by:
setPasswordValue
in 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 XWSSecurityException
set the creation time.- Parameters:
time
- If null or empty then this method would create one.- Throws:
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:
getNamespaceURI
in interfaceSecurityElement
- 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 interfaceSecurityElement
- Returns:
- this string must be interned.
-
readHeader
public XMLStreamReader readHeader() throws XMLStreamException
Description copied from interface:SecurityElement
Reads 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:
readHeader
in interfaceSecurityElement
- Returns:
- must not null.
- Throws:
XMLStreamException
-
writeTo
public void writeTo(OutputStream os)
- Specified by:
writeTo
in interfaceSecurityElementWriter
-
writeTo
public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException
Description copied from interface:SecurityElementWriter
Writes out the header.- Specified by:
writeTo
in 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:
refersToSecHdrWithId
in interfaceSecurityHeaderElement
- Parameters:
id
-- Returns:
-
writeTo
public void writeTo(XMLStreamWriter streamWriter, HashMap props) throws XMLStreamException
- Specified by:
writeTo
in interfaceSecurityElementWriter
- Throws:
XMLStreamException
-
-