com.holonplatform.auth

## Interface Account

- All Superinterfaces:
    CredentialsContainer, Serializable

      public interface Account
      extends CredentialsContainer, Serializable

  Provides account informations for authentication and authorization.
  Since:
    5.0.0
  See Also:
    `Account.AccountProvider`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Account.AccountProvider` Provider which can be used to load `Account` data.
    `static interface` | `Account.Builder` Builder to create `Account` instances.

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

      `CredentialsContainer.CredentialsMatcher`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static AuthenticationToken` | `accountCredentialsToken(String accountId, byte[] secret)` Create a new `AccountCredentialsToken` with given account id and secret.
    `static AuthenticationToken` | `accountCredentialsToken(String accountId, String secret)` Create a new `AccountCredentialsToken` with given account id and secret.
    `static Authenticator<AccountCredentialsToken>` | `authenticator(Account.AccountProvider accountProvider)` Build an `Authenticator` using `Account.AccountProvider` to load `Account` data and accepting `AccountCredentialsToken` as credentials.
    `static Authenticator<AccountCredentialsToken>` | `authenticator(Account.AccountProvider accountProvider, CredentialsContainer.CredentialsMatcher credentialsMatcher)` Build an `Authenticator` using `Account.AccountProvider` to load `Account` data and accepting `AccountCredentialsToken` as credentials.
    `static Account.Builder` | `builder(String accountId)` Builder to create `Account` instances
    `Object` | `getCredentials()` Account stored credentials data
    `Map<String,Object>` | `getDetails()` Optional account details (e.g. user name, surname, language etc.)
    `String` | `getId()` Account id (required).
    `Collection<Permission>` | `getPermissions()` Optional permissions granted to account
    `boolean` | `isEnabled()` Indicates whether this account is enabled
    `boolean` | `isExpired()` Indicates whether this account has expired
    `boolean` | `isLocked()` Indicates whether this account is locked
    `boolean` | `isRoot()` Whether account is `root`, i.e. has any permission.

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

      `defaultMatcher`

- - ### Method Detail

    - #### getId

          String getId()

      Account id (required). For example, the `username` if account represents a user.
      Returns:
        Account id

    - #### getCredentials

          Object getCredentials()

      Account stored credentials data
      Specified by:
        `getCredentials` in interface `CredentialsContainer`
      Returns:
        Account credentials

    - #### isRoot

          boolean isRoot()

      Whether account is `root`, i.e. has any permission. If this method returns true, `getPermissions()` is ignored.
      Returns:
        `true` if this account is a `root` account

    - #### getDetails

          Map<String,Object> getDetails()

      Optional account details (e.g. user name, surname, language etc.)
      Returns:
        Account details key-value map, an empty map if none

    - #### getPermissions

          Collection<Permission> getPermissions()

      Optional permissions granted to account
      Returns:
        Account permissions, an empty collection if none

    - #### isEnabled

          boolean isEnabled()

      Indicates whether this account is enabled
      Returns:
        `true` if enabled

    - #### isLocked

          boolean isLocked()

      Indicates whether this account is locked
      Returns:
        `true` if locked

    - #### isExpired

          boolean isExpired()

      Indicates whether this account has expired
      Returns:
        `true` if expired

    - #### builder

          static Account.Builder builder(String accountId)

      Builder to create `Account` instances
      Parameters:
        `accountId` - Account id (not null)
      Returns:
        Builder

    - #### authenticator

          static Authenticator<AccountCredentialsToken> authenticator(Account.AccountProvider accountProvider)

      Build an `Authenticator` using `Account.AccountProvider` to load `Account` data and accepting `AccountCredentialsToken` as credentials.

      Default CredentialsMatcher is used for AuthenticationToken credentials validation.

      Parameters:
        `accountProvider` - `Account.AccountProvider` to load `Account` data
      Returns:
        Authenticator

    - #### authenticator

          static Authenticator<AccountCredentialsToken> authenticator(Account.AccountProvider accountProvider,
                                                                      CredentialsContainer.CredentialsMatcher credentialsMatcher)

      Build an `Authenticator` using `Account.AccountProvider` to load `Account` data and accepting `AccountCredentialsToken` as credentials.
      Parameters:
        `accountProvider` - `Account.AccountProvider` to load `Account` data
        `credentialsMatcher` - `CredentialsMatcher` to use for AuthenticationToken credentials validation
      Returns:
        Authenticator

    - #### accountCredentialsToken

          static AuthenticationToken accountCredentialsToken(String accountId,
                                                             String secret)

      Create a new `AccountCredentialsToken` with given account id and secret.
      Parameters:
        `accountId` - Account id
        `secret` - Secret
      Returns:
        A new `AuthenticationToken` with given credentials

    - #### accountCredentialsToken

          static AuthenticationToken accountCredentialsToken(String accountId,
                                                             byte[] secret)

      Create a new `AccountCredentialsToken` with given account id and secret.
      Parameters:
        `accountId` - Account id
        `secret` - Secret
      Returns:
        A new `AuthenticationToken` with given credentials

Copyright © 2019 The Holon Platform. All rights reserved.