Package ganeti :: Package server :: Module rapi :: Class RemoteApiHandler
[hide private]
[frames] | no frames]

Class RemoteApiHandler

source code


REST Request Handler Class.

Instance Methods [hide private]
 
__init__(self, authenticator, reqauth, _client_cls=None)
Initializes this class.
source code
 
_GetRequestContext(self, req)
Returns the context for a request.
source code
 
AuthenticationRequired(self, req)
Determine whether authentication is required.
source code
 
Authenticate(self, req)
Checks whether a user can access a resource.
source code
 
HandleRequest(self, req)
Handles a request.
source code

Inherited from http.auth.HttpServerRequestAuthentication: GetAuthRealm, PreHandleRequest

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

Static Methods [hide private]
tuple; (string, string)
FormatErrorMessage(values)
Formats the body of an error message.
source code

Inherited from http.auth.HttpServerRequestAuthentication: ExtractSchemePassword, ExtractUserPassword, VerifyBasicAuthPassword

Class Variables [hide private]
  AUTH_REALM = "Ganeti Remote API"
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, authenticator, reqauth, _client_cls=None)
(Constructor)

source code 

Initializes this class.

Parameters:
  • authenticator (an implementation of {RapiAuthenticator} interface) - a class containing an implementation of ValidateRequest function
  • reqauth (bool) - Whether to require authentication
Overrides: object.__init__

FormatErrorMessage(values)
Static Method

source code 

Formats the body of an error message.

Parameters:
  • values (dict) - dictionary with keys code, message and explain.
Returns: tuple; (string, string)
Content-type and response body
Overrides: http.server.HttpServerHandler.FormatErrorMessage

_GetRequestContext(self, req)

source code 

Returns the context for a request.

The context is cached in the req.private variable.

AuthenticationRequired(self, req)

source code 

Determine whether authentication is required.

Parameters:
  • req - HTTP request context
Overrides: http.auth.HttpServerRequestAuthentication.AuthenticationRequired

Authenticate(self, req)

source code 

Checks whether a user can access a resource.

Returns:
username of an authenticated user or None otherwise
Overrides: http.auth.HttpServerRequestAuthentication.Authenticate

HandleRequest(self, req)

source code 

Handles a request.

Overrides: http.server.HttpServerHandler.HandleRequest