com.holonplatform.auth

## Interface AuthenticationInspector

- All Known Subinterfaces:
    AuthContext
  All Known Implementing Classes:
    DefaultAuthContext

      public interface AuthenticationInspector

  Represents an object which provides the current `Authentication`, if available. The current authentication semantic depends on the concrete authentication context to which the inspector is bound.

  A list of authorization control methods are provided to perform access control decisions using the current `Authentication`.

  Since:
    5.1.0
  See Also:
    `AuthContext`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Optional<Authentication>` | `getAuthentication()` Get the current `Authentication`, if available.
    `default boolean` | `isAuthenticated()` Gets whether an `Authentication` is available.
    `boolean` | `isPermitted(Collection<? extends Permission> permissions)` Checks if the current `Authentication` has all the specified `Permission`s.
    `default boolean` | `isPermitted(Permission... permissions)` Checks if the current `Authentication` has all the specified `Permission`s.
    `boolean` | `isPermitted(String... permissions)` Checks if the current `Authentication` has all the specified permissions, using the `String` permission representation.
    `boolean` | `isPermittedAny(Collection<? extends Permission> permissions)` Checks if the current `Authentication` has any of the specified `Permission`.
    `default boolean` | `isPermittedAny(Permission... permissions)` Checks if the current `Authentication` has any of the specified `Permission`.
    `boolean` | `isPermittedAny(String... permissions)` Checks if the current `Authentication` has any of the specified permission, using the `String` permission representation.
    `default Authentication` | `requireAuthentication()` Get the current `Authentication`, throwing an `IllegalStateException` if not available.

- - ### Method Detail

    - #### getAuthentication

          Optional<Authentication> getAuthentication()

      Get the current `Authentication`, if available.
      Returns:
        The current `Authentication`, or an empty Optional if not available.

    - #### requireAuthentication

          default Authentication requireAuthentication()

      Get the current `Authentication`, throwing an `IllegalStateException` if not available.
      Returns:
        The current `Authentication`

    - #### isAuthenticated

          default boolean isAuthenticated()

      Gets whether an `Authentication` is available.
      Returns:
        `true` if an `Authentication` is available, `false` otherwise

    - #### isPermitted

          boolean isPermitted(Collection<? extends Permission> permissions)

      Checks if the current `Authentication` has all the specified `Permission`s.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has all the specified permission, `false` otherwise

    - #### isPermitted

          default boolean isPermitted(Permission... permissions)

      Checks if the current `Authentication` has all the specified `Permission`s.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has all the specified permission, `false` otherwise

    - #### isPermitted

          boolean isPermitted(String... permissions)

      Checks if the current `Authentication` has all the specified permissions, using the `String` permission representation.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has all the specified permission, `false` otherwise

    - #### isPermittedAny

          boolean isPermittedAny(Collection<? extends Permission> permissions)

      Checks if the current `Authentication` has any of the specified `Permission`.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has any of the specified permission, `false` otherwise

    - #### isPermittedAny

          default boolean isPermittedAny(Permission... permissions)

      Checks if the current `Authentication` has any of the specified `Permission`.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has any of the specified permission, `false` otherwise

    - #### isPermittedAny

          boolean isPermittedAny(String... permissions)

      Checks if the current `Authentication` has any of the specified permission, using the `String` permission representation.

      The permission control strategy depends on the concrete authorization strategy of the current authentication context.

      Parameters:
        `permissions` - The permissions to be checked
      Returns:
        `true` if the current `Authentication` has any of the specified permission, `false` otherwise

Copyright © 2019 The Holon Platform. All rights reserved.