Skip to main content

HTTPBasic

HTTP Basic authentication.

Attributes

AttributeTypeDescription
modelHTTPBaseModelAn internal OpenAPI model representing the security scheme with the scheme type set to basic.
scheme_name`strNone`
realm`strNone`
auto_errorbool = TrueDetermines if the dependency should automatically raise an error or return None when authentication is missing or invalid.

Constructor

Signature

def HTTPBasic(
scheme_name: str | None = None,
realm: str | None = None,
description: str | None = None,
auto_error: bool = True
)

Parameters

NameTypeDescription
scheme_name`strNone` = None
realm`strNone` = None
description`strNone` = None
auto_errorbool = TrueIf True, missing credentials trigger an automatic error; if False, the dependency result is None.

Signature

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

Parameters

NameTypeDescription
scheme_name`strNone` = None
realm`strNone` = None
description`strNone` = None
auto_errorbool = TrueDetermines if the dependency should raise an error or return None when authentication is missing or invalid.

Methods


make_authenticate_headers()

@classmethod
def make_authenticate_headers() - > dict[str, str]

Constructs the WWW-Authenticate header for the response, optionally including the defined realm.

Returns

TypeDescription
dict[str, str]A dictionary containing the WWW-Authenticate header key and its Basic authentication value.