Class LoginAuthenticator

java.lang.Object
org.eclipse.jetty.security.authentication.LoginAuthenticator
All Implemented Interfaces:
Authenticator
Direct Known Subclasses:
BasicAuthenticator, DigestAuthenticator, EthereumAuthenticator, FormAuthenticator, JaspiAuthenticator, JaspiAuthenticator, MultiAuthenticator, OpenIdAuthenticator, SPNEGOAuthenticator, SslClientCertAuthenticator

public abstract class LoginAuthenticator extends Object implements Authenticator
  • Field Details

  • Constructor Details

    • LoginAuthenticator

      protected LoginAuthenticator()
  • Method Details

    • isProxyMode

      public boolean isProxyMode()
      Returns:
      true if this authenticator is in proxy mode.
      See Also:
    • setProxyMode

      public void setProxyMode(boolean proxy)
      Sets the authenticator to operate in proxy authentication mode.

      When set to true, this mode changes the behavior of the authentication helpers:

      The default is false, which uses the standard WWW-Authenticate and Authorization headers with a 401 status code.
      Parameters:
      proxy - true to enable proxy authentication mode.
    • getAuthorizationHeader

      public HttpHeader getAuthorizationHeader()
      Returns:
      The authorization header to read credentials from, either Authorization or Proxy-Authorization, depending on the proxy mode.
      See Also:
    • getChallengeHeader

      public HttpHeader getChallengeHeader()
      Returns:
      The challenge header to send to the client, either WWW-Authenticate or Proxy-Authenticate, depending on the proxy mode.
      See Also:
    • getUnauthorizedStatusCode

      public int getUnauthorizedStatusCode()
      Returns:
      The status code for an authentication challenge, either 401 or 407, depending on the proxy mode.
      See Also:
    • login

      public UserIdentity login(String username, Object password, Request request, Response response)
      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.
      Parameters:
      username - the username of the client to be authenticated
      password - the user's credential
      request - the inbound request that needs authentication
    • logout

      public void logout(Request request, Response response)
    • setConfiguration

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

      public LoginService getLoginService()
    • setLoginService

      public void setLoginService(LoginService loginService)
    • updateSession

      protected void updateSession(Request httpRequest, Response httpResponse)
      Update the session on authentication. The session is changed to a new instance with a new ID if and only if:
      Parameters:
      httpRequest - the request
      httpResponse - the response
      See Also: