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
ReadPasswordFile(file_name)
Reads 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, utils, 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

ReadPasswordFile(file_name)

source code 

Reads 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:
  • file_name (str) - Path to password file
Returns: dict
Dictionary containing PasswordFileUser instances