public class UserNameToken extends Object implements SecurityToken
UserNameToken
represents an Username
token that can be inserted into web services security header
for message level security.
This class implements SecurityToken
and can be
created through security token factory.
LIBERTY_ASSERTION_TOKEN, WSS_FAM_SSO_TOKEN, WSS_KERBEROS_TOKEN, WSS_SAML_TOKEN, WSS_SAML2_TOKEN, WSS_USERNAME_TOKEN, WSS_X509_TOKEN
Constructor and Description |
---|
UserNameToken(Element element)
Constructor to create a username token using username token xml element.
|
UserNameToken(UserNameTokenSpec tokenSpec)
Constructs a user name token with the user name token specification.
|
Modifier and Type | Method and Description |
---|---|
String |
getCreated()
Returns the created.
|
String |
getNonce()
Returns the nonce
|
String |
getPassword()
Returns the password in the username token.
|
static String |
getPasswordDigest(String password,
String nonce,
String created)
Returns the password digest for the given password using nonce
and created timestamp.
|
String |
getPasswordType()
Returns the password type.
|
String |
getSigningId()
Returns the signing id for username token.
|
String |
getTokenType()
Returns this security token type.
|
String |
getUserName()
Returns the username in the username token.
|
void |
setPassword(String passwd)
Sets the password to the username token.
|
void |
setUserName(String username)
Sets the user name in the username token.
|
Element |
toDocumentElement()
Returns the XML document element for the username security token.
|
String |
toString()
Returns as the string format for this username token
|
public UserNameToken(UserNameTokenSpec tokenSpec) throws SecurityException
tokenSpec
- the user name token specification.SecurityException
- if there is a failure.public UserNameToken(Element element) throws SecurityException
element
- username token xml element.SecurityException
- if the element parsing fails.public String getUserName()
public void setUserName(String username)
username
- the user name.public String getPassword()
public String getPasswordType()
public void setPassword(String passwd) throws SecurityException
passwd
- the password to the username token.SecurityException
- if the password digest is failed when
the digest password type is set.public String getNonce()
public String getCreated()
public String getSigningId()
public String toString()
public Element toDocumentElement() throws SecurityException
toDocumentElement
in interface SecurityToken
if
- the XML document conversion is failed.SecurityException
- if any failure is occured.public String getTokenType()
getTokenType
in interface SecurityToken
public static String getPasswordDigest(String password, String nonce, String created) throws SecurityException
password
- the password that needs to be digested.nonce
- the nonce that is used to digest the password.created
- the created that is used to digest the password.SecurityException
- if the password digest is failed.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.