com.holonplatform.auth.internal

## Class DefaultAccount

- java.lang.Object
- - com.holonplatform.auth.internal.DefaultAccount

- All Implemented Interfaces:
    Account, CredentialsContainer, Serializable

      public class DefaultAccount
      extends Object
      implements Account

  Default `Account` implementation
  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DefaultAccount.AccountBuilder` Default `DefaultAccount.AccountBuilder` implementation

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

      `Account.AccountProvider, Account.Builder`

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

      `CredentialsContainer.CredentialsMatcher`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultAccount(String id)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `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
    `int` | `hashCode()`
    `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.
    `void` | `setCredentials(Object credentials)` Set account credentials
    `void` | `setDetail(String key, Object value)` Add (or replace if given key already exists) a detail
    `void` | `setDetails(Map<String,Object> details)` Set account details
    `void` | `setEnabled(boolean enabled)` Set whether is enabled
    `void` | `setExpired(boolean expired)` Set whether has expired
    `void` | `setLocked(boolean locked)` Set whether is locked
    `void` | `setPermissions(Collection<Permission> permissions)` Set account permissions
    `void` | `setRoot(boolean root)` Set whether account is `root`, i.e. has any permission
    `String` | `toString()`

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

      `getClass, notify, notifyAll, wait, wait, wait`

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

      `accountCredentialsToken, accountCredentialsToken, authenticator, authenticator, builder`

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

      `defaultMatcher`

- - ### Constructor Detail

    - #### DefaultAccount

          public DefaultAccount(String id)

      Constructor
      Parameters:
        `id` - Account id (not null)

  - ### Method Detail

    - #### getId

          public String getId()

      Description copied from interface: `Account`
      Account id (required). For example, the `username` if account represents a user.
      Specified by:
        `getId` in interface `Account`
      Returns:
        Account id

    - #### getCredentials

          public Object getCredentials()

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

    - #### isRoot

          public boolean isRoot()

      Description copied from interface: `Account`
      Whether account is `root`, i.e. has any permission. If this method returns true, `Account.getPermissions()` is ignored.
      Specified by:
        `isRoot` in interface `Account`
      Returns:
        `true` if this account is a `root` account

    - #### getDetails

          public Map<String,Object> getDetails()

      Description copied from interface: `Account`
      Optional account details (e.g. user name, surname, language etc.)
      Specified by:
        `getDetails` in interface `Account`
      Returns:
        Account details key-value map, an empty map if none

    - #### getPermissions

          public Collection<Permission> getPermissions()

      Description copied from interface: `Account`
      Optional permissions granted to account
      Specified by:
        `getPermissions` in interface `Account`
      Returns:
        Account permissions, an empty collection if none

    - #### isEnabled

          public boolean isEnabled()

      Description copied from interface: `Account`
      Indicates whether this account is enabled
      Specified by:
        `isEnabled` in interface `Account`
      Returns:
        `true` if enabled

    - #### isLocked

          public boolean isLocked()

      Description copied from interface: `Account`
      Indicates whether this account is locked
      Specified by:
        `isLocked` in interface `Account`
      Returns:
        `true` if locked

    - #### isExpired

          public boolean isExpired()

      Description copied from interface: `Account`
      Indicates whether this account has expired
      Specified by:
        `isExpired` in interface `Account`
      Returns:
        `true` if expired

    - #### setRoot

          public void setRoot(boolean root)

      Set whether account is `root`, i.e. has any permission
      Parameters:
        `root` - If `true`, `getPermissions()` is ignored.

    - #### setCredentials

          public void setCredentials(Object credentials)

      Set account credentials
      Parameters:
        `credentials` - the credentials to set

    - #### setDetails

          public void setDetails(Map<String,Object> details)

      Set account details
      Parameters:
        `details` - the details to set

    - #### setDetail

          public void setDetail(String key,
                                Object value)

      Add (or replace if given key already exists) a detail
      Parameters:
        `key` - Key
        `value` - Value

    - #### setPermissions

          public void setPermissions(Collection<Permission> permissions)

      Set account permissions
      Parameters:
        `permissions` - the permissions to set

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Set whether is enabled
      Parameters:
        `enabled` - `true` if enabled

    - #### setLocked

          public void setLocked(boolean locked)

      Set whether is locked
      Parameters:
        `locked` - `true` if locked

    - #### setExpired

          public void setExpired(boolean expired)

      Set whether has expired
      Parameters:
        `expired` - `true` if expired

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019 The Holon Platform. All rights reserved.