com.holonplatform.auth.internal

## Class DefaultAuthentication

- java.lang.Object
- - com.holonplatform.core.internal.DefaultParameterSet
  - - com.holonplatform.auth.internal.DefaultAuthentication

- All Implemented Interfaces:
    Authentication, MutableParameterSet, ParameterSet, Serializable, Principal

      public class DefaultAuthentication
      extends DefaultParameterSet
      implements Authentication

  Default `Authentication` implementation.

  This implementation relies on Principal name as authentication identity, so `equals(Object)` and `hashCode()` methods are written according to this assumption.

  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DefaultAuthentication.AuthenticationBuilder` Default `Authentication.Builder` implementation.

    - ### Nested classes/interfaces inherited from class com.holonplatform.core.internal.DefaultParameterSet

      `DefaultParameterSet.AbstractBuilder<S extends ParameterSet,I extends DefaultParameterSet,B extends ParameterSet.Builder<S>>, DefaultParameterSet.DefaultBuilder`

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

      `Authentication.AuthenticationListener, Authentication.AuthenticationNotifier, Authentication.Builder`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultAuthentication(String name)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String` | `getName()`
    `Collection<Permission>` | `getPermissions()` Set of `Permission`s granted to principal with this Authentication
    `Optional<String>` | `getScheme()` Get the authentication scheme with which this authentication was produced.
    `int` | `hashCode()`
    `boolean` | `isRoot()` If this method returns `true`, this Authentication is considered a `root` principal, for which permission checking is always skipped, assuming that any permission is granted to this Authentication.
    `void` | `setRoot(boolean root)` Set whether this Authentication is considered a `root` principal, for which permission checking is always skipped, assuming that any permission is granted to this Authentication.
    `String` | `toString()`

    - ### Methods inherited from class com.holonplatform.core.internal.DefaultParameterSet

      `addParameter, forEachParameter, getParameter, getParameter, getParameterIf, hasNotNullParameter, hasParameter, hasParameters, hasParameterValue, removeParameter`

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

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

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

      `builder`

    - ### Methods inherited from interface java.security.Principal

      `implies`

    - ### Methods inherited from interface com.holonplatform.core.ParameterSet

      `builder, empty, forEachParameter, getParameter, getParameter, getParameter, getParameter, getParameter, getParameterIf, getParameterIf, hasNotNullParameter, hasNotNullParameter, hasParameter, hasParameter, hasParameters, hasParameterValue, hasParameterValue`

- - ### Constructor Detail

    - #### DefaultAuthentication

          public DefaultAuthentication(String name)

      Constructor
      Parameters:
        `name` - Principal name (for example, the username), not null

  - ### Method Detail

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `Principal`

    - #### getScheme

          public Optional<String> getScheme()

      Description copied from interface: `Authentication`
      Get the authentication scheme with which this authentication was produced.
      Specified by:
        `getScheme` in interface `Authentication`
      Returns:
        Optional authentication scheme name

    - #### isRoot

          public boolean isRoot()

      Description copied from interface: `Authentication`
      If this method returns `true`, this Authentication is considered a `root` principal, for which permission checking is always skipped, assuming that any permission is granted to this Authentication.
      Specified by:
        `isRoot` in interface `Authentication`
      Returns:
        `true` if this Authentication is considered a `root` principal

    - #### setRoot

          public void setRoot(boolean root)

      Set whether this Authentication is considered a `root` principal, for which permission checking is always skipped, assuming that any permission is granted to this Authentication.
      Parameters:
        `root` - `true` to set this Authentication as `root` principal

    - #### getPermissions

          public Collection<Permission> getPermissions()

      Description copied from interface: `Authentication`
      Set of `Permission`s granted to principal with this Authentication
      Specified by:
        `getPermissions` in interface `Authentication`
      Returns:
        Granted permissions, or an empty Collection if none

    - #### toString

          public String toString()

      Specified by:
        `toString` in interface `Principal`
      Overrides:
        `toString` in class `DefaultParameterSet`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Principal`
      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Specified by:
        `equals` in interface `Principal`
      Overrides:
        `equals` in class `Object`

Copyright © 2019 The Holon Platform. All rights reserved.