Skip to main content

HTTPDigest

HTTP Digest authentication.

Warning: this is only a stub to connect the components with OpenAPI in FastAPI, but it doesn't implement the full Digest scheme, you would need to subclass it and implement it in your code.

Attributes

AttributeTypeDescription
modelHTTPBaseModelThis attribute stores an instance of HTTPBaseModel, which defines the security scheme as "digest" and includes an optional description for OpenAPI documentation.
scheme_namestrThis attribute stores the security scheme name, which will be included in the generated OpenAPI documentation (e.g., visible at /docs).
auto_errorboolThis attribute controls the error handling behavior: if True, HTTPDigest will automatically cancel the request and send an error when the HTTP Digest is not provided; if False, the dependency result will be None, allowing for optional authentication.

Constructor

Signature

def HTTPDigest(
scheme_name: str | None = None,
description: str | None = None,
auto_error: bool = True
) - > null

Parameters

NameTypeDescription
scheme_name`strNone` = None
description`strNone` = None
auto_errorbool = TrueBy default, if the HTTP Digest is not provided, HTTPDigest will automatically cancel the request and send the client an error. If auto_error is set to False, when the HTTP Digest is not available, instead of erroring out, the dependency result will be None. This is useful when you want to have optional authentication. It is also useful when you want to have authentication that can be provided in one of multiple optional ways (for example, in HTTP Digest or in a cookie).