com.holonplatform.auth.token

## Class AccountCredentialsToken

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

- All Implemented Interfaces:
    AuthenticationToken, CredentialsContainer, Serializable

      public class AccountCredentialsToken
      extends Object
      implements AuthenticationToken

  Basic `AuthenticationToken` to represent a generic account authentication. Account is identified by an id and a secret (of String type).

  This AuthenticationToken could for example represent the widely-used user authentication mechanism providing username and password.

  This token returns a String from `getPrincipal()` representing account id and a byte[] from `getCredentials()` representing provided secret.

  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
    `AccountCredentialsToken()` Constructor
    `AccountCredentialsToken(String accountId, String secret)` Constructor with account id and secret.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `void` | `setAccountId(String accountId)` Set account id
    `void` | `setSecret(byte[] secret)` Set provided secret
    `void` | `setSecret(String secret)` Set provided secret as String

    - ### 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

    - #### AccountCredentialsToken

          public AccountCredentialsToken()

      Constructor

    - #### AccountCredentialsToken

          public AccountCredentialsToken(String accountId,
                                         String secret)

      Constructor with account id and secret.
      Parameters:
        `accountId` - Account id
        `secret` - Secret (for example a password)

  - ### Method Detail

    - #### setAccountId

          public void setAccountId(String accountId)

      Set account id
      Parameters:
        `accountId` - the account id to set

    - #### setSecret

          public void setSecret(byte[] secret)

      Set provided secret
      Parameters:
        `secret` - the secret to set

    - #### setSecret

          public void setSecret(String secret)

      Set provided secret as String
      Parameters:
        `secret` - the secret to set

    - #### 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

Copyright © 2017 The Holon Platform. All rights reserved.