Class WSUsernameTokenPrincipalImpl
- java.lang.Object
-
- org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl
-
- All Implemented Interfaces:
Serializable
,Principal
,UsernameTokenPrincipal
public class WSUsernameTokenPrincipalImpl extends Object implements Serializable, UsernameTokenPrincipal
This class implements thePrincipal
interface and represents a UsernameToken user. In addition to the principal's name this principal object also contains 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 typePasswordDigest
. 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. Theequals()
method use the prinicipal's name only and does not compare nonce or created time. Modelled according to the example provided by JAAS documentation- See Also:
Principal
,Subject
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WSUsernameTokenPrincipalImpl(String name, boolean digest)
Create a WSUsernameTokenPrincipalImpl with a WSUsernameToken username.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Compares the specified Object with thisWSUsernameTokenPrincipal
for equality.String
getCreatedTime()
Return the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl
.String
getName()
Return the WSUsernameToken username for thisWSUsernameTokenPrincipalImpl
.byte[]
getNonce()
Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl
.String
getPassword()
Return the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl
.String
getPasswordType()
int
hashCode()
Return a hash code for thisWSUsernameTokenPrincipalImpl
.boolean
isPasswordDigest()
Return the WSUsernameToken password type for thisWSUsernameTokenPrincipalImpl
.void
setCreatedTime(String createdTime)
Set the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl
.void
setNonce(byte[] nonce)
Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl
.void
setPassword(String password)
Set the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl
.void
setPasswordType(String passwordType)
String
toString()
Return a string representation of thisWSUsernameTokenPrincipalImpl
.
-
-
-
Constructor Detail
-
WSUsernameTokenPrincipalImpl
public WSUsernameTokenPrincipalImpl(String name, boolean digest)
Create a WSUsernameTokenPrincipalImpl with a WSUsernameToken username.- Parameters:
name
- the WSUsernameToken username for this user.
-
-
Method Detail
-
getName
public String getName()
Return the WSUsernameToken username for thisWSUsernameTokenPrincipalImpl
.
-
isPasswordDigest
public boolean isPasswordDigest()
Return the WSUsernameToken password type for thisWSUsernameTokenPrincipalImpl
.- Specified by:
isPasswordDigest
in interfaceUsernameTokenPrincipal
- Returns:
- true if the password type was
PassowrdDigest
-
setPassword
public void setPassword(String password)
Set the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl
.- Parameters:
password
-
-
getPassword
public String getPassword()
Return the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl
.- Specified by:
getPassword
in interfaceUsernameTokenPrincipal
- Returns:
- the WSUsernameToken password for this
WSUsernameTokenPrincipalImpl
-
setNonce
public void setNonce(byte[] nonce)
Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl
.- Parameters:
nonce
-
-
getNonce
public byte[] getNonce()
Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl
.- Specified by:
getNonce
in interfaceUsernameTokenPrincipal
- Returns:
- the WSUsernameToken nonce for this
WSUsernameTokenPrincipalImpl
-
setCreatedTime
public void setCreatedTime(String createdTime)
Set the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl
.- Parameters:
createdTime
-
-
getCreatedTime
public String getCreatedTime()
Return the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl
.- Specified by:
getCreatedTime
in interfaceUsernameTokenPrincipal
- Returns:
- the WSUsernameToken created time for this
WSUsernameTokenPrincipalImpl
-
toString
public String toString()
Return a string representation of thisWSUsernameTokenPrincipalImpl
.
-
getPasswordType
public String getPasswordType()
- Specified by:
getPasswordType
in interfaceUsernameTokenPrincipal
- Returns:
- Returns the passwordType.
-
setPasswordType
public void setPasswordType(String passwordType)
- Parameters:
passwordType
- The passwordType to set.
-
equals
public boolean equals(Object o)
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.
-
-