Package org.apache.ws.security
Class WSUsernameTokenPrincipal
- java.lang.Object
-
- org.apache.ws.security.WSUsernameTokenPrincipal
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Principal
public class WSUsernameTokenPrincipal extends java.lang.Object implements java.security.Principal, java.io.SerializableThis class implements thePrincipalinterface 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 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. Modeled according to the example provided by JAAS documentation- Author:
- Davanum Srinivas (dims@yahoo.com)., Werner Dittmann (Werner.Dittmann@siemens.com).
- See Also:
Principal,Subject, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WSUsernameTokenPrincipal(java.lang.String name, boolean digest)Create a WSUsernameTokenPrincipal with a WSUsernameToken username.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Compares the specified Object with thisWSUsernameTokenPrincipalfor equality.java.lang.StringgetCreatedTime()Return the WSUsernameToken created time for thisWSUsernameTokenPrincipal.java.lang.StringgetName()Return the WSUsernameToken username for thisWSUsernameTokenPrincipal.java.lang.StringgetNonce()Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipal.java.lang.StringgetPassword()Return the WSUsernameToken password for thisWSUsernameTokenPrincipal.java.lang.StringgetPasswordType()inthashCode()Return a hash code for thisWSUsernameTokenPrincipal.booleanisPasswordDigest()Return the WSUsernameToken password type for thisWSUsernameTokenPrincipal.voidsetCreatedTime(java.lang.String createdTime)Set the WSUsernameToken created time for thisWSUsernameTokenPrincipal.voidsetNonce(java.lang.String nonce)Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipal.voidsetPassword(java.lang.String password)Set the WSUsernameToken password for thisWSUsernameTokenPrincipal.voidsetPasswordType(java.lang.String passwordType)java.lang.StringtoString()Return a string representation of thisWSUsernameTokenPrincipal.
-
-
-
Constructor Detail
-
WSUsernameTokenPrincipal
public WSUsernameTokenPrincipal(java.lang.String name, boolean digest)Create a WSUsernameTokenPrincipal with a WSUsernameToken username.- Parameters:
name- the WSUsernameToken username for this user.- Throws:
java.lang.NullPointerException- if thenameisnull.
-
-
Method Detail
-
getName
public java.lang.String getName()
Return the WSUsernameToken username for thisWSUsernameTokenPrincipal.- Specified by:
getNamein interfacejava.security.Principal- Returns:
- the WSUsernameToken username for this
WSUsernameTokenPrincipal
-
isPasswordDigest
public boolean isPasswordDigest()
Return the WSUsernameToken password type for thisWSUsernameTokenPrincipal.- Returns:
- true if the password type was
PassowrdDigest
-
setPassword
public void setPassword(java.lang.String password)
Set the WSUsernameToken password for thisWSUsernameTokenPrincipal.- Parameters:
password-
-
getPassword
public java.lang.String getPassword()
Return the WSUsernameToken password for thisWSUsernameTokenPrincipal.- Returns:
- the WSUsernameToken password for this
WSUsernameTokenPrincipal
-
setNonce
public void setNonce(java.lang.String nonce)
Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipal.- Parameters:
nonce-
-
getNonce
public java.lang.String getNonce()
Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipal.- Returns:
- the WSUsernameToken nonce for this
WSUsernameTokenPrincipal
-
setCreatedTime
public void setCreatedTime(java.lang.String createdTime)
Set the WSUsernameToken created time for thisWSUsernameTokenPrincipal.- Parameters:
createdTime-
-
getCreatedTime
public java.lang.String getCreatedTime()
Return the WSUsernameToken created time for thisWSUsernameTokenPrincipal.- Returns:
- the WSUsernameToken created time for this
WSUsernameTokenPrincipal
-
toString
public java.lang.String toString()
Return a string representation of thisWSUsernameTokenPrincipal.- Specified by:
toStringin interfacejava.security.Principal- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this
WSUsernameTokenPrincipal.
-
getPasswordType
public java.lang.String getPasswordType()
- Returns:
- Returns the passwordType.
-
setPasswordType
public void setPasswordType(java.lang.String passwordType)
- Parameters:
passwordType- The passwordType to set.
-
equals
public boolean equals(java.lang.Object o)
Compares the specified Object with thisWSUsernameTokenPrincipalfor equality. Returns true if the given object is also aWSUsernameTokenPrincipaland the two WSUsernameTokenPrincipals have the same username.- Specified by:
equalsin interfacejava.security.Principal- Overrides:
equalsin classjava.lang.Object- Parameters:
o- Object to be compared for equality with thisWSUsernameTokenPrincipal.- Returns:
- true if the specified Object is equal equal to this
WSUsernameTokenPrincipal.
-
hashCode
public int hashCode()
Return a hash code for thisWSUsernameTokenPrincipal.- Specified by:
hashCodein interfacejava.security.Principal- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code for this
WSUsernameTokenPrincipal.
-
-