-
class
auth_functional.
RequestFixtureMiddleware
[source]¶ Middleware that sets a fixture object with registered fixture functions as methods.
-
auth_functional.
and_
(*conditions)[source]¶ Decorator that takes multiple condition functions and the if one is False returns False.
Parameters: conditions – Multiple condition functions.
-
auth_functional.
authentication
(view=None, authenticator=None, www_authenticate=None, response_factory=None)[source]¶ Check request’s authentication.
Parameters: - view – View or class-based view to decorate.
- authenticator – Callable that checks request’s authentication. If None the default
method: DEFAULT_AUTHENTICATOR is used. The callable is passed the request along with args/kwargs passed by the dispatcher. :param www_authenticate: Header to send in the response as a request to the client to authenticate if the authentication failed. :param response_factory: Callable to use for building the response. Useful if you want to prepare the response yourself. The callable is passed the request along with args/kwargs passed by the dispatcher.
Returns: HTTP 401 “Unauthorized” response if the authentication failed, otherwise the response returned by the decorated view.
Check request’s authorization.
Parameters: condition – Callable that returns True if the request is authorized and False otherwise. The callable is passed the request along with args/kwargs passed by the dispatcher. :param response_factory: Callable to use for building the response. Useful if you want to prepare the response yourself. The callable is passed the request along with args/kwargs passed by the dispatcher.
Returns: HTTP 403 “Forbidden” response if the authorization failed, otherwise the response returned by the decorated view.