Package org.apache.ws.security
Class WSUsernameTokenPrincipal
java.lang.Object
org.apache.ws.security.WSUsernameTokenPrincipal
- All Implemented Interfaces:
Serializable
,Principal
This class implements the
Principal
interface and
represents a UsernameToken user.
In addition to the principal's name
this principal object also conatins the nonce and created time of the
UsernameToken (refer to the OASIS WS Security specification, UsernameToken
profile). These values are set only if the password of UsernameToken was of
type PasswordDigest
.
Furthermore the password type is
provided to the application. The password type is the string of the type
attribute of the password element inside the username token. Refer to the
OASIS WSS specification for predefined password types. The
equals()
method use the prinicipal's name only and does not
compare nonce or created time.
Modeled according to the example provided
by JAAS documentation
- Author:
- Davanum Srinivas (dims@yahoo.com)., Werner Dittmann (Werner.Dittmann@siemens.com).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWSUsernameTokenPrincipal
(String name, boolean digest) Create a WSUsernameTokenPrincipal with a WSUsernameToken username. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified Object with thisWSUsernameTokenPrincipal
for equality.Return the WSUsernameToken created time for thisWSUsernameTokenPrincipal
.getName()
Return the WSUsernameToken username for thisWSUsernameTokenPrincipal
.getNonce()
Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipal
.Return the WSUsernameToken password for thisWSUsernameTokenPrincipal
.int
hashCode()
Return a hash code for thisWSUsernameTokenPrincipal
.boolean
Return the WSUsernameToken password type for thisWSUsernameTokenPrincipal
.void
setCreatedTime
(String createdTime) Set the WSUsernameToken created time for thisWSUsernameTokenPrincipal
.void
Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipal
.void
setPassword
(String password) Set the WSUsernameToken password for thisWSUsernameTokenPrincipal
.void
setPasswordType
(String passwordType) toString()
Return a string representation of thisWSUsernameTokenPrincipal
.
-
Constructor Details
-
WSUsernameTokenPrincipal
Create a WSUsernameTokenPrincipal with a WSUsernameToken username.- Parameters:
name
- the WSUsernameToken username for this user.- Throws:
NullPointerException
- if thename
isnull
.
-
-
Method Details
-
getName
Return the WSUsernameToken username for thisWSUsernameTokenPrincipal
. -
isPasswordDigest
public boolean isPasswordDigest()Return the WSUsernameToken password type for thisWSUsernameTokenPrincipal
.- Returns:
- true if the password type was
PassowrdDigest
-
setPassword
Set the WSUsernameToken password for thisWSUsernameTokenPrincipal
.- Parameters:
password
-
-
getPassword
Return the WSUsernameToken password for thisWSUsernameTokenPrincipal
.- Returns:
- the WSUsernameToken password for this
WSUsernameTokenPrincipal
-
setNonce
Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipal
.- Parameters:
nonce
-
-
getNonce
Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipal
.- Returns:
- the WSUsernameToken nonce for this
WSUsernameTokenPrincipal
-
setCreatedTime
Set the WSUsernameToken created time for thisWSUsernameTokenPrincipal
.- Parameters:
createdTime
-
-
getCreatedTime
Return the WSUsernameToken created time for thisWSUsernameTokenPrincipal
.- Returns:
- the WSUsernameToken created time for this
WSUsernameTokenPrincipal
-
toString
Return a string representation of thisWSUsernameTokenPrincipal
. -
getPasswordType
- Returns:
- Returns the passwordType.
-
setPasswordType
- Parameters:
passwordType
- The passwordType to set.
-
equals
Compares the specified Object with thisWSUsernameTokenPrincipal
for equality. Returns true if the given object is also aWSUsernameTokenPrincipal
and the two WSUsernameTokenPrincipals have the same username. -
hashCode
public int hashCode()Return a hash code for thisWSUsernameTokenPrincipal
.
-