Commit f8bd7df3 authored by Michael Hanselmann's avatar Michael Hanselmann

ganeti.http: Prepare authentication for HTTP server

The authentication class will override PreHandleRequest.

Reviewed-by: amishchenko
parent dd875d32
...@@ -308,6 +308,10 @@ class _HttpServerRequestExecutor(object): ...@@ -308,6 +308,10 @@ class _HttpServerRequestExecutor(object):
handler_context = _HttpServerRequest(self.request_msg) handler_context = _HttpServerRequest(self.request_msg)
try: try:
# Authentication, etc.
self.server.PreHandleRequest(handler_context)
# Call actual request handler
result = self.server.HandleRequest(handler_context) result = self.server.HandleRequest(handler_context)
except (http.HttpException, KeyboardInterrupt, SystemExit): except (http.HttpException, KeyboardInterrupt, SystemExit):
raise raise
...@@ -501,6 +505,13 @@ class HttpServer(http.HttpBase): ...@@ -501,6 +505,13 @@ class HttpServer(http.HttpBase):
else: else:
self._children.append(pid) self._children.append(pid)
def PreHandleRequest(self, req):
"""Called before handling a request.
Can be overriden by a subclass.
"""
def HandleRequest(self, req): def HandleRequest(self, req):
"""Handles a request. """Handles a request.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment