Class UsernamePasswordCredential

java.lang.Object
jakarta.security.enterprise.credential.AbstractClearableCredential
jakarta.security.enterprise.credential.UsernamePasswordCredential
All Implemented Interfaces:
Credential
Direct Known Subclasses:
BasicAuthenticationCredential

public class UsernamePasswordCredential extends AbstractClearableCredential
Represents the credentials typically used by standard caller name/password authentication.
  • Constructor Details Link icon

    • UsernamePasswordCredential Link icon

      public UsernamePasswordCredential(String callerName, String password)
      Constructor.
      Parameters:
      callerName - The caller name
      password - The password, as a String
    • UsernamePasswordCredential Link icon

      public UsernamePasswordCredential(String callerName, Password password)
      Constructor.
      Parameters:
      callerName - The caller name
      password - The password
  • Method Details Link icon

    • getPassword Link icon

      public Password getPassword()
      Determines the password.
      Returns:
      The password.
    • getPasswordAsString Link icon

      public String getPasswordAsString()
      Determines the password.
      Returns:
      The password, as a String.
    • clearCredential Link icon

      public void clearCredential()
      Description copied from class: AbstractClearableCredential
      Invokes the specific subclass to securely clear the credential value. Some Credential subclasses contain credential values which are inherently secure, such as tokens, for which clearing the credential may not be necessary.

      For example, if the credential includes a password, this method would overwrite the password value.

      Specified by:
      clearCredential in class AbstractClearableCredential
    • getCaller Link icon

      public String getCaller()
    • compareTo Link icon

      public boolean compareTo(String callerName, String password)