HttpAuthenticator (HttpClient Library (Version 3.1))
Date: 2019-09-02

org.apache.commons.httpclient.auth

## Class HttpAuthenticator

- java.lang.Object
- - org.apache.commons.httpclient.auth.HttpAuthenticator

- Deprecated.
  no longer used

      public final class HttpAuthenticator
      extends java.lang.Object

  Utility methods for HTTP authorization and authentication. This class provides utility methods for generating responses to HTTP www and proxy authentication challenges.

  > A client SHOULD assume that all paths at or deeper than the depth of the last symbolic element in the path field of the Request-URI also are within the protection space specified by the basic realm value of the current challenge. A client MAY preemptively send the corresponding Authorization header with requests for resources in that space without receipt of another challenge from the server. Similarly, when a client sends a request to a proxy, it may reuse a userid and password in the Proxy-Authorization header field without receiving another challenge from the proxy server.

  Author:
    Remy Maucherat, Rodney Waldhoff, Jeff Dever, Ortwin Glueck, Sean C. Sullivan, Adrian Sutton, Mike Bowler, Oleg Kalnichevski

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROXY_AUTH` Deprecated. The proxy authenticate challange header.
    `static java.lang.String` | `PROXY_AUTH_RESP` Deprecated. The proxy authenticate response header.
    `static java.lang.String` | `WWW_AUTH` Deprecated. The www authenticate challange header.
    `static java.lang.String` | `WWW_AUTH_RESP` Deprecated. The www authenticate response header.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpAuthenticator()` Deprecated.

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `authenticate(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state)` Deprecated. use AuthScheme
    `static boolean` | `authenticateDefault(HttpMethod method, HttpConnection conn, HttpState state)` Deprecated. use AuthScheme
    `static boolean` | `authenticateProxy(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state)` Deprecated. use AuthScheme
    `static boolean` | `authenticateProxyDefault(HttpMethod method, HttpConnection conn, HttpState state)` Deprecated. use AuthScheme
    `static AuthScheme` | `selectAuthScheme(Header[] challenges)` Deprecated. Use `AuthChallengeParser.parseChallenges(Header[])` and `AuthPolicy.getAuthScheme(String)`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### WWW_AUTH

          public static final java.lang.String WWW_AUTH

      Deprecated.
      The www authenticate challange header.
      See Also:
        Constant Field Values

    - #### WWW_AUTH_RESP

          public static final java.lang.String WWW_AUTH_RESP

      Deprecated.
      The www authenticate response header.
      See Also:
        Constant Field Values

    - #### PROXY_AUTH

          public static final java.lang.String PROXY_AUTH

      Deprecated.
      The proxy authenticate challange header.
      See Also:
        Constant Field Values

    - #### PROXY_AUTH_RESP

          public static final java.lang.String PROXY_AUTH_RESP

      Deprecated.
      The proxy authenticate response header.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HttpAuthenticator

          public HttpAuthenticator()

      Deprecated.

  - ### Method Detail

    - #### selectAuthScheme

          public static AuthScheme selectAuthScheme(Header[] challenges)
                                             throws MalformedChallengeException

      Deprecated. Use `AuthChallengeParser.parseChallenges(Header[])` and `AuthPolicy.getAuthScheme(String)`
      Chooses the strongest authentication scheme supported from the array of authentication challenges. Currently only `NTLM`, `Digest`, `Basic` schemes are recognized. The `NTLM` scheme is considered the strongest and is preferred to all others. The `Digest` scheme is preferred to the `Basic` one which provides no encryption for credentials. The `Basic` scheme is used only if it is the only one supported.
      Parameters:
        `challenges` - The array of authentication challenges
      Returns:
        The strongest authentication scheme supported
      Throws:
        `MalformedChallengeException` - is thrown if an authentication challenge is malformed
        `java.lang.UnsupportedOperationException` - when none of challenge types available is supported.

    - #### authenticateDefault

          public static boolean authenticateDefault(HttpMethod method,
                                                    HttpConnection conn,
                                                    HttpState state)
                                             throws AuthenticationException

      Deprecated. use AuthScheme
      Attempt to provide default authentication credentials to the given method in the given context using basic authentication scheme.
      Parameters:
        `method` - the HttpMethod which requires authentication
        `conn` - the connection to a specific host. This parameter may be `null` if default credentials (not specific to any particular host) are to be used
        `state` - the HttpState object providing Credentials
      Returns:
        true if the `Authenticate` response header was added
      Throws:
        `InvalidCredentialsException` - if authentication credentials are not valid or not applicable for basic scheme
        `AuthenticationException` - when a parsing or other error occurs
      See Also:
        `HttpState.setCredentials(String,String,Credentials)`

    - #### authenticateProxyDefault

          public static boolean authenticateProxyDefault(HttpMethod method,
                                                         HttpConnection conn,
                                                         HttpState state)
                                                  throws AuthenticationException

      Deprecated. use AuthScheme
      Attempt to provide default proxy authentication credentials to the given method in the given context using basic authentication scheme.
      Parameters:
        `method` - the HttpMethod which requires authentication
        `conn` - the connection to a specific host. This parameter may be `null` if default credentials (not specific to any particular host) are to be used
        `state` - the HttpState object providing Credentials
      Returns:
        true if the `Proxy-Authenticate` response header was added
      Throws:
        `InvalidCredentialsException` - if authentication credentials are not valid or not applicable for basic scheme
        `AuthenticationException` - when a parsing or other error occurs
      See Also:
        `HttpState.setCredentials(String,String,Credentials)`

    - #### authenticate

          public static boolean authenticate(AuthScheme authscheme,
                                             HttpMethod method,
                                             HttpConnection conn,
                                             HttpState state)
                                      throws AuthenticationException

      Deprecated. use AuthScheme
      Attempt to provide requisite authentication credentials to the given method in the given context using the given authentication scheme.
      Parameters:
        `authscheme` - The authentication scheme to be used
        `method` - The HttpMethod which requires authentication
        `conn` - the connection to a specific host. This parameter may be `null` if default credentials (not specific to any particular host) are to be used
        `state` - The HttpState object providing Credentials
      Returns:
        true if the `Authenticate` response header was added
      Throws:
        `CredentialsNotAvailableException` - if authentication credentials required to respond to the authentication challenge are not available
        `AuthenticationException` - when a parsing or other error occurs
      See Also:
        `HttpState.setCredentials(String,String,Credentials)`

    - #### authenticateProxy

          public static boolean authenticateProxy(AuthScheme authscheme,
                                                  HttpMethod method,
                                                  HttpConnection conn,
                                                  HttpState state)
                                           throws AuthenticationException

      Deprecated. use AuthScheme
      Attempt to provide requisite proxy authentication credentials to the given method in the given context using the given authentication scheme.
      Parameters:
        `authscheme` - The authentication scheme to be used
        `method` - the HttpMethod which requires authentication
        `conn` - the connection to a specific host. This parameter may be `null` if default credentials (not specific to any particular host) are to be used
        `state` - the HttpState object providing Credentials
      Returns:
        true if the `Proxy-Authenticate` response header was added
      Throws:
        `CredentialsNotAvailableException` - if authentication credentials required to respond to the authentication challenge are not available
        `AuthenticationException` - when a parsing or other error occurs
      See Also:
        `HttpState.setCredentials(String,String,Credentials)`

Copyright (c) 1999-2005 - Apache Software Foundation