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

Class HttpServerRequestAuthentication

source code


Instance Methods [hide private]
string
GetAuthRealm(self, req)
Returns the authentication realm for a request.
source code
 
AuthenticationRequired(self, req)
Determines whether authentication is required for a request.
source code
 
PreHandleRequest(self, req)
Called before a request is handled.
source code
bool
_CheckAuthorization(self, req)
Checks 'Authorization' header sent by client.
source code
bool
_CheckBasicAuthorization(self, req, in_data)
Checks credentials sent for basic authentication.
source code
 
Authenticate(self, req, user, password)
Checks the password for a user.
source code
 
VerifyBasicAuthPassword(self, req, username, password, expected)
Checks the password for basic authentication.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  AUTH_REALM = "Unspecified"
  _CLEARTEXT_SCHEME = "{CLEARTEXT}"
  _HA1_SCHEME = "{HA1}"
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

GetAuthRealm(self, req)

source code 

Returns the authentication realm for a request.

May be overridden by a subclass, which then can return different realms for different paths.

Parameters:
Returns: string
Authentication realm

AuthenticationRequired(self, req)

source code 

Determines whether authentication is required for a request.

To enable authentication, override this function in a subclass and return True. AUTH_REALM must be set.

Parameters:

PreHandleRequest(self, req)

source code 

Called before a request is handled.

Parameters:

_CheckAuthorization(self, req)

source code 

Checks 'Authorization' header sent by client.

Parameters:
Returns: bool
Whether user is allowed to execute request

_CheckBasicAuthorization(self, req, in_data)

source code 

Checks credentials sent for basic authentication.

Parameters:
Returns: bool
Whether user is allowed to execute request

Authenticate(self, req, user, password)

source code 

Checks the password for a user.

This function MUST be overridden by a subclass.

VerifyBasicAuthPassword(self, req, username, password, expected)

source code 

Checks the password for basic authentication.

As long as they don't start with an opening brace ("{"), old passwords are supported. A new scheme uses H(A1) from RFC2617, where H is MD5 and A1 consists of the username, the authentication realm and the actual password.

Parameters:
  • req (http.server._HttpServerRequest) - HTTP request context
  • username (string) - Username from HTTP headers
  • password (string) - Password from HTTP headers
  • expected (string) - Expected password with optional scheme prefix (e.g. from users file)