com.holonplatform.auth.token

## Class BearerAuthenticationToken

- java.lang.Object
- - com.holonplatform.auth.token.BearerAuthenticationToken

- All Implemented Interfaces:
    AuthenticationToken, CredentialsContainer, Serializable

      public class BearerAuthenticationToken
      extends Object
      implements AuthenticationToken

  `AuthenticationToken` representing a Bearer authententication token.

  This AuthenticationToken returns always `null` from `getPrincipal()` and returns the token from `getCredentials()`.

  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.auth.AuthenticationToken

      `AuthenticationToken.AuthenticationTokenResolver<R extends Message>`

    - ### Nested classes/interfaces inherited from interface com.holonplatform.auth.CredentialsContainer

      `CredentialsContainer.CredentialsMatcher`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BearerAuthenticationToken(String token)` Construct a new BearerAuthenticationToken

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BearerAuthenticationToken` | `create(String token)` Create a new `BearerAuthenticationToken` with given token.
    `Object` | `getCredentials()` Returns the credentials submitted during the authentication process that verifies the submitted `AuthenticationToken.getPrincipal()` account identity.
    `Object` | `getPrincipal()` Get the principal to which this authentication token refers, i.e. the account identity submitted during the authentication process.

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

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

    - ### Methods inherited from interface com.holonplatform.auth.AuthenticationToken

      `accountCredentials, bearer, httpBasicResolver, httpBearerResolver`

    - ### Methods inherited from interface com.holonplatform.auth.CredentialsContainer

      `defaultMatcher`

- - ### Constructor Detail

    - #### BearerAuthenticationToken

          public BearerAuthenticationToken(String token)

      Construct a new BearerAuthenticationToken
      Parameters:
        `token` - Bearer token value

  - ### Method Detail

    - #### getPrincipal

          public Object getPrincipal()

      Description copied from interface: `AuthenticationToken`
      Get the principal to which this authentication token refers, i.e. the account identity submitted during the authentication process.
      Specified by:
        `getPrincipal` in interface `AuthenticationToken`
      Returns:
        Principal to authenticate (for example a username)

    - #### getCredentials

          public Object getCredentials()

      Description copied from interface: `AuthenticationToken`
      Returns the credentials submitted during the authentication process that verifies the submitted `AuthenticationToken.getPrincipal()` account identity.
      Specified by:
        `getCredentials` in interface `AuthenticationToken`
      Specified by:
        `getCredentials` in interface `CredentialsContainer`
      Returns:
        the credential submitted by the user during the authentication process

    - #### create

          public static BearerAuthenticationToken create(String token)

      Create a new `BearerAuthenticationToken` with given token.
      Parameters:
        `token` - Bearer token
      Returns:
        A new `BearerAuthenticationToken` with given credentials

Copyright © 2019 The Holon Platform. All rights reserved.