org.apache.hc.client5.http.auth

## Class AuthExchange

- java.lang.Object
- - org.apache.hc.client5.http.auth.AuthExchange

-     public class AuthExchange
      extends Object

  This class represents the actual state of authentication handshake including the current `AuthScheme` used for request authorization as well as a collection of backup authentication options if available.
  Since:
    4.5

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AuthExchange.State`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthExchange()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Queue<AuthScheme>` | `getAuthOptions()` Returns available auth options.
    `AuthScheme` | `getAuthScheme()` Returns actual `AuthScheme`.
    `String` | `getPathPrefix()`
    `AuthExchange.State` | `getState()`
    `boolean` | `isConnectionBased()` Returns `true` if the actual authentication scheme is connection based.
    `void` | `reset()`
    `void` | `select(AuthScheme authScheme)` Resets the auth state with `AuthScheme` and clears auth options.
    `void` | `setOptions(Queue<AuthScheme> authOptions)` Updates the auth state with a queue of auth options.
    `void` | `setPathPrefix(String pathPrefix)`
    `void` | `setState(AuthExchange.State state)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### AuthExchange

          public AuthExchange()

  - ### Method Detail

    - #### reset

          public void reset()

    - #### getState

          public AuthExchange.State getState()

    - #### setState

          public void setState(AuthExchange.State state)

    - #### getAuthScheme

          public AuthScheme getAuthScheme()

      Returns actual `AuthScheme`. May be null.

    - #### isConnectionBased

          public boolean isConnectionBased()

      Returns `true` if the actual authentication scheme is connection based.

    - #### getPathPrefix

          public String getPathPrefix()

      Since:
        5.2

    - #### setPathPrefix

          public void setPathPrefix(String pathPrefix)

      Since:
        5.2

    - #### select

          public void select(AuthScheme authScheme)

      Resets the auth state with `AuthScheme` and clears auth options.
      Parameters:
        `authScheme` - auth scheme. May not be null.

    - #### getAuthOptions

          public Queue<AuthScheme> getAuthOptions()

      Returns available auth options. May be null.

    - #### setOptions

          public void setOptions(Queue<AuthScheme> authOptions)

      Updates the auth state with a queue of auth options.
      Parameters:
        `authOptions` - a queue of auth options. May not be null or empty.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.