Class DigestAuthenticator.DigestInfo

  • Enclosing class:
    DigestAuthenticator

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

      Constructors 
      Constructor Description
      DigestInfo​(java.lang.String opaque, long nonceValidity, java.lang.String key, java.util.Map<java.lang.String,​DigestAuthenticator.NonceInfo> nonces, boolean validateUri)
      Create a new DigestInfo instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.security.Principal authenticate​(Realm realm)
      Authenticate the user against the given realm using the parsed digest credentials.
      java.lang.String getUsername()
      Get the authenticated user name.
      boolean isNonceStale()
      Check if the nonce has expired and is considered stale.
      boolean parse​(Request request, java.lang.String authorization)
      Parse the authorization header to extract digest credentials.
      boolean validate​(Request request)
      Deprecated.
      boolean validate​(Request request, java.util.List<DigestAuthenticator.AuthDigest> algorithms)
      Validate the parsed digest credentials against the request and configured algorithms.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DigestInfo

        public DigestInfo​(java.lang.String opaque,
                          long nonceValidity,
                          java.lang.String key,
                          java.util.Map<java.lang.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 Detail

      • getUsername

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

        public boolean parse​(Request request,
                             java.lang.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,
                                java.util.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 java.security.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