Package com.codingchili.core.protocol
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 TypeMethodDescriptionboolean
Retrieves the RequestHandler of a route matching the route id and that any of the given roles have permission to.list()
void
Adds a new route to the handler.
-
Method Details
-
use
Adds a new route to the handler.- Parameters:
route
- the route to add
-
get
RequestHandler<T> get(String route, RoleType role) throws AuthorizationRequiredException, HandlerMissingExceptionRetrieves 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 retrieverole
- 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
- Parameters:
route
- id of the route to check if it is contained in the handler.- Returns:
- true if the route is registered.
-
list
- Returns:
- all routes that has been added to the handler.
-