Interface AuthorizationHandler<T>

Type Parameters:
T - type of requests to check authorization for
All Known Implementing Classes:
SimpleAuthorizationHandler

public interface AuthorizationHandler<T>
Handles the mapping of routes to roles.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains​(String route)
     
    get​(String route, RoleType role)
    Retrieves the RequestHandler of a route matching the route id and that any of the given roles have permission to.
     
    void
    use​(Route<T> route)
    Adds a new route to the handler.
  • Method Details

    • use

      void use(Route<T> route)
      Adds a new route to the handler.
      Parameters:
      route - the route to add
    • get

      Retrieves the RequestHandler of a route matching the route id and that any of the given roles have permission to.
      Parameters:
      route - the id of the route to retrieve
      role - the role used in the authorization check
      Returns:
      a request handler used for the route.
      Throws:
      AuthorizationRequiredException - when a route exists but none of the given roles has permission to execute it.
      HandlerMissingException - when the requested route is missing.
    • contains

      boolean contains(String route)
      Parameters:
      route - id of the route to check if it is contained in the handler.
      Returns:
      true if the route is registered.
    • list

      List<Route<T>> list()
      Returns:
      all routes that has been added to the handler.