Revised the documentation of the DigestAuth class and the calc_response function.
This commit is contained in:
parent
e6b4594393
commit
b6bfb2eae9
@ -49,16 +49,16 @@ def calc_response(
|
|||||||
:param uri: The request URI.
|
:param uri: The request URI.
|
||||||
:param password_hash: The password hash for the HTTP digest authentication.
|
:param password_hash: The password hash for the HTTP digest authentication.
|
||||||
:param nonce: The nonce.
|
:param nonce: The nonce.
|
||||||
:param qop: the quality of protection.
|
:param qop: the quality of protection, either "auth" or "auth-int".
|
||||||
:param algorithm: The algorithm, either "MD5" or "MD5-sess".
|
:param algorithm: The algorithm, either "MD5" or "MD5-sess".
|
||||||
:param cnonce: The client nonce, which must exists when qop exists or
|
:param cnonce: The client nonce, which must exists when qop exists or
|
||||||
algorithm="MD5-sess".
|
algorithm="MD5-sess".
|
||||||
:param nc: The request counter, which must exists when qop exists.
|
:param nc: The request counter, which must exists when qop exists.
|
||||||
:param body: The request body, which must exists when qop="auth-int".
|
:param body: The request body, which must exists when qop="auth-int".
|
||||||
:return: The response value.
|
:return: The response value.
|
||||||
:raise UnauthorizedException: When the cnonce is missing with the MD5-sess
|
:raise UnauthorizedException: When cnonce is missing with the
|
||||||
algorithm, when the body is missing with the auth-int qop, or when the
|
algorithm="MD5-sess", when body is missing with qop="auth-int", or when
|
||||||
cnonce or nc is missing with the auth or auth-int qop.
|
cnonce or nc is missing with qop exits.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def validate_required(field: t.Optional[str], error: str) -> None:
|
def validate_required(field: t.Optional[str], error: str) -> None:
|
||||||
@ -75,8 +75,8 @@ def calc_response(
|
|||||||
"""Calculates and returns the first hash.
|
"""Calculates and returns the first hash.
|
||||||
|
|
||||||
:return: The first hash.
|
:return: The first hash.
|
||||||
:raise UnauthorizedException: When the cnonce is missing with the MD5-sess
|
:raise UnauthorizedException: When the cnonce is missing with
|
||||||
algorithm.
|
algorithm="MD5-sess".
|
||||||
"""
|
"""
|
||||||
if algorithm == "MD5-sess":
|
if algorithm == "MD5-sess":
|
||||||
validate_required(
|
validate_required(
|
||||||
|
@ -103,7 +103,7 @@ class DigestAuth:
|
|||||||
def login_required(self, view) -> t.Callable:
|
def login_required(self, view) -> t.Callable:
|
||||||
"""The view decorator for HTTP digest authentication.
|
"""The view decorator for HTTP digest authentication.
|
||||||
|
|
||||||
:param view:
|
:param view: The view.
|
||||||
:return: The login-protected view.
|
:return: The login-protected view.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -217,10 +217,10 @@ class DigestAuth:
|
|||||||
raise UnauthorizedException("Invalid nonce")
|
raise UnauthorizedException("Invalid nonce")
|
||||||
|
|
||||||
def make_response_header(self, state: AuthState) -> str:
|
def make_response_header(self, state: AuthState) -> str:
|
||||||
"""Composes and returns the WWW-Authenticate response header.
|
"""Composes and returns the ``WWW-Authenticate`` response header.
|
||||||
|
|
||||||
:param state: The authorization state.
|
:param state: The authorization state.
|
||||||
:return: The WWW-Authenticate response header.
|
:return: The ``WWW-Authenticate`` response header.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_opaque() -> t.Optional[str]:
|
def get_opaque() -> t.Optional[str]:
|
||||||
|
Loading…
Reference in New Issue
Block a user