public class UsernamePasswordToken extends Object implements AuthenticationToken
Note that this class stores a password as a char[] instead of a String (which may seem more logical). This is because Strings are immutable and their internal value cannot be overwritten - meaning even a nulled String instance might be accessible in memory at a later time (e.g. memory dump). This is not good for sensitive information such as passwords. For more information, see the Java Cryptography Extension Reference Guide.
| Constructor and Description |
|---|
UsernamePasswordToken(String username,
char[] password)
Constructor
|
UsernamePasswordToken(String username,
char[] password,
String host)
Constructor
|
UsernamePasswordToken(String username,
String password)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getCredentials()
Returns the credentials submitted by the user during the authentication
process that verifies the submitted
account
identity. |
String |
getHost() |
char[] |
getPassword() |
Object |
getPrincipal()
Returns the account identity submitted during the authentication process.
|
String |
getUsername() |
public UsernamePasswordToken(String username, char[] password)
username - usernamepassword - passwordpublic UsernamePasswordToken(String username, String password)
username - usernamepassword - passwordpublic String getUsername()
public char[] getPassword()
public String getHost()
public Object getPrincipal()
AuthenticationToken
Most application authentications are username/password based and have
this object represent a username. If this is the case for your
application, take a look at the UsernamePasswordToken, as it is probably sufficient for your use.
Ultimately, the object returned is application specific and can represent any account identity.
getPrincipal in interface AuthenticationTokenUsernamePasswordTokenpublic Object getCredentials()
AuthenticationTokenaccount
identity.
Most application authentications are username/password based and have
this object represent a submitted password. If this is the case for your
application, take a look at the UsernamePasswordToken, as it is probably sufficient for your use.
Ultimately, the credentials Object returned is application specific and can represent any credential mechanism.
getCredentials in interface AuthenticationTokenCopyright © 2013-2018–2019 SeedStack. All rights reserved.