Class DigestAuthenticator.DigestInfo

java.lang.Object
org.apache.catalina.authenticator.DigestAuthenticator.DigestInfo
Enclosing class:
DigestAuthenticator

public static class DigestAuthenticator.DigestInfo extends Object
Holds the parsed and validated information from a Digest authentication request.
  • Constructor Details

    • DigestInfo

      public DigestInfo(String opaque, long nonceValidity, String key, Map<String, DigestAuthenticator.NonceInfo> nonces, boolean validateUri)
      Create a new DigestInfo instance.
      Parameters:
      opaque - Opaque string
      nonceValidity - Nonce validity in milliseconds
      key - Private key
      nonces - Map of tracked nonces
      validateUri - Whether to validate the URI
  • Method Details

    • getUsername

      public String getUsername()
      Get the authenticated user name.
      Returns:
      User name
    • parse

      public boolean parse(Request request, String authorization)
      Parse the authorization header to extract digest credentials.
      Parameters:
      request - HTTP request
      authorization - Authorization header value
      Returns:
      true if parsing succeeded
    • validate

      @Deprecated public boolean validate(Request request)
      Deprecated.
    • validate

      public boolean validate(Request request, List<DigestAuthenticator.AuthDigest> algorithms)
      Validate the parsed digest credentials against the request and configured algorithms.
      Parameters:
      request - HTTP request
      algorithms - Configured authentication algorithms
      Returns:
      true if validation succeeded
    • isNonceStale

      public boolean isNonceStale()
      Check if the nonce has expired and is considered stale.
      Returns:
      true if the nonce is stale
    • authenticate

      public Principal authenticate(Realm realm)
      Authenticate the user against the given realm using the parsed digest credentials.
      Parameters:
      realm - Realm to authenticate against
      Returns:
      Principal if authentication succeeded, null otherwise