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

    • 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
      Validate a request
      Parameters:
      req - The request
      res - The response
      callback - the callback to use for writing a response
      Returns:
      An Authentication. If Authentication is successful, this will be a AuthenticationState.Succeeded. If a response has been sent by the Authenticator (which can be done for both successful and unsuccessful authentications), then the result will implement AuthenticationState.ResponseSent.
      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)