|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.rsa.swsj.profiles.wss.Token
com.rsa.swsj.profiles.wss.UsernameToken
The UsernameToken provides a way for a SOAP message security
header to include a username and password.
UsernameToken object, it is necessary to
provide a username value. Optionally, a password can be included in the
<UsernameToken> element.
The following example demonstrates the creation of a new Username token and
password options.
// create a default context SWSJContext ctx = new SWJContext(); String id = "userNameId"; String userName = "Username"; String password = "password".; UsernameToken token = new UsernameToken (ctx, id, userName); // when this method is called, a password will be digested // and added to the token as well as >Nonce< and >Created< // elements. token.setPassword (password); // when this method is called, a password will not be digested and // will not be added to the token if the boolean value is set to false setPassword(password, true);When receiving a SOAP message containing a <UsernameToken> object, the contents of the token are often viewed for verification purposes. To retrieve the username contained in a
UsernameToken object,
simply use the getUsername() method, as shown below.
UsernameToken token = <A UsernameToken obtained from a SOAP message> String username = token.getUsername();
| Constructor Summary | |
UsernameToken(SWSJContext context)
Creates an empty |
|
UsernameToken(SWSJContext context,
java.lang.String id,
java.lang.String username)
Creates a |
|
| Method Summary | |
java.util.Calendar |
getCreationTime()
Get the time of creation. |
byte[] |
getNonce()
Get the Nonce value. |
java.lang.String |
getPassword()
Get the Password value. |
java.lang.String |
getUsername()
Gets the |
void |
setCreationTime(java.util.Calendar created)
Set the value for creation time. |
void |
setPassword(java.lang.String password)
Sets the password value during creation of the token or when the password needs to be validated. |
void |
setPassword(java.lang.String password,
boolean addToMessage)
Sets the password value during creation of the token. |
void |
setUsername(java.lang.String username)
Sets the |
| Methods inherited from class com.rsa.swsj.profiles.wss.Token |
getContext, getId, getNamespacePrefix, setId, setNamespacePrefix |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public UsernameToken(SWSJContext context)
throws InvalidParameterException
UsernameToken object that is initialized
only with a context.
context - An object that collects a number of common parameters and
state variables; for example, JCE provider.
InvalidParameterException - If context is invalid.
public UsernameToken(SWSJContext context,
java.lang.String id,
java.lang.String username)
throws InvalidParameterException
UsernameToken object that is initialized with the
context, an identifier, and the user name for that token.
context - A SWSJContext object that collects a number
of common parameters and state variables; for example, JCE
provider.id - A String object that identifies the id to use for
referencing this token.username - A String object that is the user id for
this username token.
InvalidParameterException - If an invalid value is set.| Method Detail |
public java.util.Calendar getCreationTime()
Calendar object that indicates the creation time
and reflects coordinated universal time (UTC).
public void setCreationTime(java.util.Calendar created)
throws InvalidParameterException
created - A Calendar object that indicates the
creation time and reflects coordinated universal time (UTC).
InvalidParameterException - If an invalid value is set.public byte[] getNonce()
public java.lang.String getPassword()
String object that contains the Password value.
public void setPassword(java.lang.String password)
throws TokenException,
InvalidParameterException
password - A String object that contains the password
value.
TokenException - If the password digest is invalid.
InvalidParameterException - If an invalid value is set.
public void setPassword(java.lang.String password,
boolean addToMessage)
throws InvalidParameterException
true; otherwise, this password is only used for a security
operation.
addToMessage - A boolean flag that specifies if this
password should be added to the output message.
InvalidParameterException - If an invalid value is set.public java.lang.String getUsername()
username value.
username value.
public void setUsername(java.lang.String username)
throws InvalidParameterException
username value.
username - A String object that contains the username
value.
InvalidParameterException - If an invalid value is set.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||