DigestAuthenticator.DigestInfo (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.catalina.authenticator, class: DigestAuthenticator, class: DigestInfo

# 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 Summary

  Constructors
  Constructor
  Description
  `DigestInfo(String opaque, long nonceValidity, String key, Map<String, DigestAuthenticator.NonceInfo> nonces, boolean validateUri)`
  Create a new DigestInfo instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Principal`
  `authenticate(Realm realm)`
  Authenticate the user against the given realm using the parsed digest credentials.
  `String`
  `getUsername()`
  Get the authenticated user name.
  `boolean`
  `isNonceStale()`
  Check if the nonce has expired and is considered stale.
  `boolean`
  `parse(Request request, String authorization)`
  Parse the authorization header to extract digest credentials.
  `boolean`
  `validate(Request request, List<DigestAuthenticator.AuthDigest> algorithms)`
  Validate the parsed digest credentials against the request and configured algorithms.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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

    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