Class DigestAuthenticator

java.lang.Object
org.eclipse.jetty.security.authentication.LoginAuthenticator
org.eclipse.jetty.security.authentication.DigestAuthenticator
All Implemented Interfaces:
Authenticator

public class DigestAuthenticator extends LoginAuthenticator
The nonce max age in ms can be set with the SecurityHandler.setParameter(String, String) using the name "maxNonceAge". The nonce max count can be set with SecurityHandler.setParameter(String, String) using the name "maxNonceCount". When the age or count is exceeded, the nonce is considered stale.
  • Constructor Details

    • DigestAuthenticator

      public DigestAuthenticator()
  • Method Details

    • setAlgorithm

      public void setAlgorithm(String algorithm)
    • getAlgorithm

      public String getAlgorithm()
    • setConfiguration

      public void setConfiguration(Authenticator.Configuration configuration)
      Description copied from interface: Authenticator
      Configure the Authenticator
      Specified by:
      setConfiguration in interface Authenticator
      Overrides:
      setConfiguration in class LoginAuthenticator
      Parameters:
      configuration - the configuration
    • getMaxNonceCount

      public int getMaxNonceCount()
    • setMaxNonceCount

      public void setMaxNonceCount(int maxNC)
    • getMaxNonceAge

      public long getMaxNonceAge()
    • setMaxNonceAge

      public void setMaxNonceAge(long maxNonceAgeInMillis)
    • getAuthenticationType

      public String getAuthenticationType()
      Returns:
      The name of the authentication type
    • validateRequest

      public AuthenticationState validateRequest(Request req, Response res, Callback callback) throws ServerAuthException
      Description copied from interface: Authenticator
      Attempts to validate the authentication state of the given request.

      If authentication is successful, an AuthenticationState.Succeeded is returned. If the authenticator has already committed a response (for either success or failure), the returned value will implement AuthenticationState.ResponseSent, and the provided Callback will be eventually be completed, otherwise the caller is responsible for completing the Callback.

      A null return value indicates that no authentication state could be established, possibly because the response has already been committed.

      Parameters:
      req - the request to validate.
      res - the response associated with the request.
      callback - the callback to use for writing a response.
      Returns:
      an AuthenticationState, or null if authentication could not be resolved.
      Throws:
      ServerAuthException - if unable to validate request.
    • login

      public UserIdentity login(String username, Object credentials, Request request, Response response)
      Description copied from class: LoginAuthenticator
      If the UserIdentity returned from LoginService.login(String, Object, Request, Function) is not null, it is assumed that the user is fully authenticated and we need to change the session id to prevent session fixation vulnerability. If the UserIdentity is not necessarily fully authenticated, then subclasses must override this method and determine when the UserIdentity IS fully authenticated and renew the session id.
      Overrides:
      login in class LoginAuthenticator
      Parameters:
      username - the username of the client to be authenticated
      credentials - the user's credential
      request - the inbound request that needs authentication
    • newNonce

      public String newNonce(Request request)