flexmeasures.auth.error_handling
Auth error handling.
- Beware: There is a historical confusion of naming between authentication and authorization.
Names of Responses have to be kept as they were called in original W3 protocols. See explanation below.
Functions
- flexmeasures.auth.error_handling.unauthenticated_handler(mechanisms: list | None = None, headers: dict | None = None)
Handler for authentication problems. :param mechanisms: a list of which authentication mechanisms were tried. :param headers: a dict of headers to return. We respond with json if the request doesn’t say otherwise. Also, other FlexMeasures packages can define that they want to wrap JSON responses and/or render HTML error pages (for non-JSON requests) in custom ways ― by registering unauthenticated_handler_api & unauthenticated_handler_html, respectively.
- flexmeasures.auth.error_handling.unauthenticated_handler_e(e)
Swallow error. Useful for classical Flask error handler registration.
- flexmeasures.auth.error_handling.unauthorized_handler(func: Callable | None = None, params: list | None = None)
Handler for authorization problems. :param func: the Flask-Security-Too decorator, if relevant, and params are its parameters.
We respond with json if the request doesn’t say otherwise. Also, other FlexMeasures packages can define that they want to wrap JSON responses and/or render HTML error pages (for non-JSON requests) in custom ways ― by registering unauthorized_handler_api & unauthorized_handler_html, respectively.
- flexmeasures.auth.error_handling.unauthorized_handler_e(e)
Swallow error. Useful for classical Flask error handler registration.