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 the
Principal 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
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.
Modelled according to the example provided
by JAAS documentation
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWSUsernameTokenPrincipalImpl(String name, boolean digest) Create a WSUsernameTokenPrincipalImpl with a WSUsernameToken username. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares the specified Object with thisWSUsernameTokenPrincipalfor equality.Return the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl.getName()Return the WSUsernameToken username for thisWSUsernameTokenPrincipalImpl.byte[]getNonce()Return the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl.Return the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl.inthashCode()Return a hash code for thisWSUsernameTokenPrincipalImpl.booleanReturn the WSUsernameToken password type for thisWSUsernameTokenPrincipalImpl.voidsetCreatedTime(String createdTime) Set the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl.voidsetNonce(byte[] nonce) Set the WSUsernameToken nonce for thisWSUsernameTokenPrincipalImpl.voidsetPassword(String password) Set the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl.voidsetPasswordType(String passwordType) toString()Return a string representation of thisWSUsernameTokenPrincipalImpl.
-
Constructor Details
-
WSUsernameTokenPrincipalImpl
Create a WSUsernameTokenPrincipalImpl with a WSUsernameToken username.- Parameters:
name- the WSUsernameToken username for this user.
-
-
Method Details
-
getName
Return the WSUsernameToken username for thisWSUsernameTokenPrincipalImpl. -
isPasswordDigest
public boolean isPasswordDigest()Return the WSUsernameToken password type for thisWSUsernameTokenPrincipalImpl.- Specified by:
isPasswordDigestin interfaceUsernameTokenPrincipal- Returns:
- true if the password type was
PassowrdDigest
-
setPassword
Set the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl.- Parameters:
password-
-
getPassword
Return the WSUsernameToken password for thisWSUsernameTokenPrincipalImpl.- Specified by:
getPasswordin 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:
getNoncein interfaceUsernameTokenPrincipal- Returns:
- the WSUsernameToken nonce for this
WSUsernameTokenPrincipalImpl
-
setCreatedTime
Set the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl.- Parameters:
createdTime-
-
getCreatedTime
Return the WSUsernameToken created time for thisWSUsernameTokenPrincipalImpl.- Specified by:
getCreatedTimein interfaceUsernameTokenPrincipal- Returns:
- the WSUsernameToken created time for this
WSUsernameTokenPrincipalImpl
-
toString
Return a string representation of thisWSUsernameTokenPrincipalImpl. -
getPasswordType
- Specified by:
getPasswordTypein interfaceUsernameTokenPrincipal- Returns:
- Returns the passwordType.
-
setPasswordType
- Parameters:
passwordType- The passwordType to set.
-
equals
Compares the specified Object with thisWSUsernameTokenPrincipalfor equality. Returns true if the given object is also aWSUsernameTokenPrincipaland the two WSUsernameTokenPrincipals have the same username. -
hashCode
public int hashCode()Return a hash code for thisWSUsernameTokenPrincipalImpl.
-