Package ganeti :: Package http :: Module auth
[hide private]
[frames] | no frames]

Module auth

source code

HTTP authentication module.

Classes [hide private]
  HttpServerRequestAuthentication
  PasswordFileUser
Data structure for users from password file.
Functions [hide private]
str
_FormatAuthHeader(scheme, params)
Formats WWW-Authentication header value as per RFC2617, section 1.2
source code
dict
ParsePasswordFile(contents)
Parses the contents of a password file.
source code
Variables [hide private]
  HTTP_BASIC_AUTH = "Basic"
  HTTP_DIGEST_AUTH = "Digest"
  _NOQUOTE = re.compile(r"^[-_a-z0-9]+$", re.I)

Imports: logging, re, base64, binascii, compat, http, StringIO


Function Details [hide private]

_FormatAuthHeader(scheme, params)

source code 

Formats WWW-Authentication header value as per RFC2617, section 1.2

Parameters:
  • scheme (str) - Authentication scheme
  • params (dict) - Additional parameters
Returns: str
Formatted header value

ParsePasswordFile(contents)

source code 

Parses the contents of a password file.

Lines in the password file are of the following format:

   <username> <password> [options]

Fields are separated by whitespace. Username and password are mandatory, options are optional and separated by comma (','). Empty lines and comments ('#') are ignored.

Parameters:
  • contents (str) - Contents of password file
Returns: dict
Dictionary containing PasswordFileUser instances