org.apache.hc.client5.http.auth

## Class BearerToken

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

- All Implemented Interfaces:
    Serializable, Credentials

      @Contract(threading=IMMUTABLE)
      public class BearerToken
      extends Object
      implements Credentials, Serializable

  Opaque token `Credentials` usually representing a set of claims, often encrypted or signed. The JWT (JSON Web Token) is among most widely used tokens used at the time of writing.
  Since:
    5.3
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BearerToken(String token)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `char[]` | `getPassword()` Deprecated. Do not use.
    `String` | `getToken()`
    `Principal` | `getUserPrincipal()`
    `int` | `hashCode()`

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

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

- - ### Constructor Detail

    - #### BearerToken

          public BearerToken(String token)

  - ### Method Detail

    - #### getUserPrincipal

          public Principal getUserPrincipal()

      Specified by:
        `getUserPrincipal` in interface `Credentials`

    - #### getPassword

          @Deprecated
          public char[] getPassword()

      Deprecated. Do not use.
      Specified by:
        `getPassword` in interface `Credentials`

    - #### getToken

          public String getToken()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

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