Package com.sun.identity.wss.security
Class UserNameToken
- java.lang.Object
-
- com.sun.identity.wss.security.UserNameToken
-
- All Implemented Interfaces:
SecurityToken
public class UserNameToken extends Object implements SecurityToken
This classUserNameTokenrepresents an Username token that can be inserted into web services security header for message level security.This class implements
SecurityTokenand can be created through security token factory.
-
-
Field Summary
-
Fields inherited from interface com.sun.identity.wss.security.SecurityToken
LIBERTY_ASSERTION_TOKEN, WSS_FAM_SSO_TOKEN, WSS_KERBEROS_TOKEN, WSS_SAML_TOKEN, WSS_SAML2_TOKEN, WSS_USERNAME_TOKEN, WSS_X509_TOKEN
-
-
Constructor Summary
Constructors Constructor Description UserNameToken(UserNameTokenSpec tokenSpec)Constructs a user name token with the user name token specification.UserNameToken(Element element)Constructor to create a username token using username token xml element.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCreated()Returns the created.StringgetNonce()Returns the nonceStringgetPassword()Returns the password in the username token.static StringgetPasswordDigest(String password, String nonce, String created)Returns the password digest for the given password using nonce and created timestamp.StringgetPasswordType()Returns the password type.StringgetSigningId()Returns the signing id for username token.StringgetTokenType()Returns this security token type.StringgetUserName()Returns the username in the username token.voidsetPassword(String passwd)Sets the password to the username token.voidsetUserName(String username)Sets the user name in the username token.ElementtoDocumentElement()Returns the XML document element for the username security token.StringtoString()Returns as the string format for this username token
-
-
-
Constructor Detail
-
UserNameToken
public UserNameToken(UserNameTokenSpec tokenSpec) throws SecurityException
Constructs a user name token with the user name token specification.- Parameters:
tokenSpec- the user name token specification.- Throws:
SecurityException- if there is a failure.
-
UserNameToken
public UserNameToken(Element element) throws SecurityException
Constructor to create a username token using username token xml element.- Parameters:
element- username token xml element.- Throws:
SecurityException- if the element parsing fails.
-
-
Method Detail
-
getUserName
public String getUserName()
Returns the username in the username token.- Returns:
- the user name
-
setUserName
public void setUserName(String username)
Sets the user name in the username token.- Parameters:
username- the user name.
-
getPassword
public String getPassword()
Returns the password in the username token.- Returns:
- the password in the username token.
-
getPasswordType
public String getPasswordType()
Returns the password type.- Returns:
- the password type.
-
setPassword
public void setPassword(String passwd) throws SecurityException
Sets the password to the username token.- Parameters:
passwd- the password to the username token.- Throws:
SecurityException- if the password digest is failed when the digest password type is set.
-
getNonce
public String getNonce()
Returns the nonce- Returns:
- the nonce
-
getCreated
public String getCreated()
Returns the created.- Returns:
- the created.
-
getSigningId
public String getSigningId()
Returns the signing id for username token.- Returns:
- the signing id for the username token.
-
toString
public String toString()
Returns as the string format for this username token
-
toDocumentElement
public Element toDocumentElement() throws SecurityException
Returns the XML document element for the username security token.- Specified by:
toDocumentElementin interfaceSecurityToken- Returns:
- Element the XML Element for the username security token.
- Throws:
SecurityException- if any failure is occured.
-
getTokenType
public String getTokenType()
Returns this security token type.- Specified by:
getTokenTypein interfaceSecurityToken- Returns:
- user name security token.
-
getPasswordDigest
public static String getPasswordDigest(String password, String nonce, String created) throws SecurityException
Returns the password digest for the given password using nonce and created timestamp.- Parameters:
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.- Throws:
SecurityException- if the password digest is failed.
-
-