Interface Guard

All Known Implementing Classes:
DefaultGuard

public interface Guard
The Guard protects a single object.
See Also:
  • Method Details

    • getPrincipal

      Principal getPrincipal()
    • getSecured

      Object getSecured()
      Get the object this guard is protecting
      Returns:
      The object this guard is protecting.
    • evaluatePermission

      Guard.Decision evaluatePermission(Permission permission)
      Evaluates a permission. This method returns an Guard.Decision providing some more information about *why* a permission is granted or denied.
      Parameters:
      permission - The permission to evaluate.
      Returns:
      An Guard.Decision.
    • askPermission

      boolean askPermission(Permission permission)
      Ask the guard for a specific permission. This method is usually used by the user interface, e.g. to disable buttons.
      Parameters:
      permission - The permission to check.
      Returns:
      true, if the permission is granted, false, if it's denied.
    • askPermission

      boolean askPermission(String expression) throws InvalidPermissionException
      Ask the guard for a specific permission. This method is usually used by the user interface, e.g. to disable buttons.
      Parameters:
      expression - The permission to check as permission string.
      Returns:
      true, if the permission is granted, false, if it's denied.
      Throws:
      InvalidPermissionException - If the permission string cannot be parsed or mapped to a permission object.
    • checkPermission

      void checkPermission(Permission permission) throws UnauthorizedException
      Ask the guard for a specific permission throwing an exception, if the permission is denied. This method is usually used by the protected object.
      Parameters:
      permission - The permission to check.
      Throws:
      UnauthorizedException - If the permission is denied.
    • checkPermission

      void checkPermission(String expression) throws UnauthorizedException, InvalidPermissionException
      Ask the guard for a specific permission throwing an exception, if the permission is denied. This method is usually used by the protected object.
      Parameters:
      expression - The permission to check as permission string.
      Throws:
      UnauthorizedException - If the permission is denied.
      InvalidPermissionException - If the permission string cannot be parsed or mapped to a permission object.
    • getSecurityContext

      SecurityContext getSecurityContext()