org.apache.hc.client5.http.impl.auth

## Class BasicCredentialsProvider

- java.lang.Object
- - org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider

- All Implemented Interfaces:
    CredentialsProvider, CredentialsStore

      @Contract(threading=SAFE)
      public class BasicCredentialsProvider
      extends Object
      implements CredentialsStore

  Default implementation of `CredentialsStore`.
  Since:
    4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicCredentialsProvider()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears all credentials.
    `Credentials` | `getCredentials(AuthScope authScope, HttpContext context)` Returns `credentials` for the given authentication scope, if available.
    `void` | `setCredentials(AuthScope authScope, Credentials credentials)` Sets the `credentials` for the given authentication scope.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### BasicCredentialsProvider

          public BasicCredentialsProvider()

      Default constructor.

  - ### Method Detail

    - #### setCredentials

          public void setCredentials(AuthScope authScope,
                                     Credentials credentials)

      Description copied from interface: `CredentialsStore`
      Sets the `credentials` for the given authentication scope. Any previous credentials for the given scope will be overwritten.
      Specified by:
        `setCredentials` in interface `CredentialsStore`
      Parameters:
        `authScope` - the `authentication scope`
        `credentials` - the authentication `credentials` for the given scope.
      See Also:
        `CredentialsProvider.getCredentials(AuthScope, org.apache.hc.core5.http.protocol.HttpContext)`

    - #### getCredentials

          public Credentials getCredentials(AuthScope authScope,
                                            HttpContext context)

      Description copied from interface: `CredentialsProvider`
      Returns `credentials` for the given authentication scope, if available.
      Specified by:
        `getCredentials` in interface `CredentialsProvider`
      Parameters:
        `authScope` - the `authentication scope`
        `context` - the `http context`
      Returns:
        the credentials

    - #### clear

          public void clear()

      Description copied from interface: `CredentialsStore`
      Clears all credentials.
      Specified by:
        `clear` in interface `CredentialsStore`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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