Exceptions

All exceptions are subclasses of falcon HTTPUnauthorized.

class falcon_auth2.AuthenticationFailure(*, title: str | None = None, description: str | None = None, headers: HeaderArg | None = None, challenges: Iterable[str] | None = None, **kwargs: HTTPErrorKeywordArguments)[source]

Raised when an authentication backend fails to authenticate a syntactically correct request.

This will terminate the request with status 401 if no other logic is present.

code

An internal application code that a user can reference when requesting support for the error.

description

Description of the error to send to the client.

headers

Extra headers to add to the response.

An href that the client can provide to the user for getting help.

status

HTTP status code or line (e.g., '200 OK').

This may be set to a member of http.HTTPStatus, an HTTP status line string or byte string (e.g., '200 OK'), or an int.

title

Error title to send to the client.

Derived from the status if not provided.

class falcon_auth2.BackendNotApplicable(*, title: str | None = None, description: str | None = None, headers: HeaderArg | None = None, challenges: Iterable[str] | None = None, **kwargs: HTTPErrorKeywordArguments)[source]

Raised when a request is not understood by an authentication backend. This may indicate that the request is intended for another backend.

This will terminate the request with status 401 if no other logic is present.

code

An internal application code that a user can reference when requesting support for the error.

description

Description of the error to send to the client.

headers

Extra headers to add to the response.

An href that the client can provide to the user for getting help.

status

HTTP status code or line (e.g., '200 OK').

This may be set to a member of http.HTTPStatus, an HTTP status line string or byte string (e.g., '200 OK'), or an int.

title

Error title to send to the client.

Derived from the status if not provided.

class falcon_auth2.UserNotFound(*, title: str | None = None, description: str | None = None, headers: HeaderArg | None = None, challenges: Iterable[str] | None = None, **kwargs: HTTPErrorKeywordArguments)[source]

Raised when the user_loader callable of an authentication backend cannot load an user with the received payload. This may indicate that the request is intended for another backend.

This will terminate the request with status 401 if no other logic is present.

code

An internal application code that a user can reference when requesting support for the error.

description

Description of the error to send to the client.

headers

Extra headers to add to the response.

An href that the client can provide to the user for getting help.

status

HTTP status code or line (e.g., '200 OK').

This may be set to a member of http.HTTPStatus, an HTTP status line string or byte string (e.g., '200 OK'), or an int.

title

Error title to send to the client.

Derived from the status if not provided.