com.holonplatform.auth

## Interface Authentication

- All Superinterfaces:
    ParameterSet, Principal, Serializable
  All Known Subinterfaces:
    SpringSecurityAuthentication

      public interface Authentication
      extends Principal, ParameterSet

  Represents an authenticated principal (for example a user) using `Authenticator.authenticate(AuthenticationToken)`.

  Extends standard `Principal` interface, so the the principal name (for example the username) can be obtained using `Principal.getName()`.

  Supports authorizations using `Permission` grants. All granted permissions should be provided by `getPermissions()` method. If `isRoot()` returns `true`, this authentication will be treated as `root`, i.e. with all permissions, and any granted permission will be ignored.

  Since:
    5.0.0
  See Also:
    `Authenticator`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Authentication.AuthenticationListener` Listener to handle authentication events.
    `static interface` | `Authentication.AuthenticationNotifier` Supports `Authentication.AuthenticationListener` registration.
    `static interface` | `Authentication.Builder` Builder to create `Authentication` instances.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Authentication.Builder` | `builder(String principalName)` Builder to create Authentication instance for given `principalName`.
    `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.
    `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.

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

      `equals, getName, hashCode, implies, toString`

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

- - ### Method Detail

    - #### getScheme

          Optional<String> getScheme()

      Get the authentication scheme with which this authentication was produced.
      Returns:
        Optional authentication scheme name

    - #### getPermissions

          Collection<Permission> getPermissions()

      Set of `Permission`s granted to principal with this Authentication
      Returns:
        Granted permissions, or an empty Collection if none

    - #### isRoot

          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.
      Returns:
        `true` if this Authentication is considered a `root` principal

    - #### builder

          static Authentication.Builder builder(String principalName)

      Builder to create Authentication instance for given `principalName`.
      Parameters:
        `principalName` - `Principal` name (not null)
      Returns:
        AuthenticationBuilder

Copyright © 2019 The Holon Platform. All rights reserved.