userver: pytest_userver.utils.httpdigest Namespace Reference
Loading...
Searching...
No Matches
pytest_userver.utils.httpdigest Namespace Reference

Detailed Description

Helpers to act as a minimal MD5 Digest client or server from Python.

Classes

class  DigestAuthClient
 Minimal stateful Digest client for functional tests. More...

Functions

str _md5 (str data)
dict parse_directives (str header)
 Parses a WWW-Authenticate or an Authorization header value.
dict construct_challenge (*, dict auth_directives, str|None nonce=None)
str construct_header (*, str username, str password, dict challenge, str uri, str method)
 Builds a single Authorization: Digest ... header value.
str calculate_response (*, str username, str password, str realm, str nonce, str nonce_count, str cnonce, str qop, str method, str uri)
 Server side counterpart: the expected value of the response directive.

Variables

 _DIRECTIVE_RE = re.compile(r'(\w+)=("[^"]*"|[^,\s]+)')

Function Documentation

◆ _md5()

str _md5 ( str data)
protected

Definition at line 13 of file httpdigest.py.

◆ calculate_response()

str calculate_response ( * ,
str username,
str password,
str realm,
str nonce,
str nonce_count,
str cnonce,
str qop,
str method,
str uri )

Server side counterpart: the expected value of the response directive.

Definition at line 56 of file httpdigest.py.

◆ construct_challenge()

dict construct_challenge ( * ,
dict auth_directives,
str | None nonce = None )

Definition at line 24 of file httpdigest.py.

◆ construct_header()

str construct_header ( * ,
str username,
str password,
dict challenge,
str uri,
str method )

Builds a single Authorization: Digest ... header value.

Definition at line 47 of file httpdigest.py.

◆ parse_directives()

dict parse_directives ( str header)

Parses a WWW-Authenticate or an Authorization header value.

Definition at line 17 of file httpdigest.py.

Variable Documentation

◆ _DIRECTIVE_RE

pytest_userver.utils.httpdigest._DIRECTIVE_RE = re.compile(r'(\w+)=("[^"]*"|[^,\s]+)')
protected

Definition at line 10 of file httpdigest.py.