Compare commits
24 commits
ws_endpoin
...
master
Author | SHA1 | Date | |
---|---|---|---|
ab150963af | |||
e36cff1a3d | |||
4622a5d274 | |||
2863795580 | |||
1c79f0c4d9 | |||
3904819032 | |||
92ae9d79a2 | |||
e903272dd8 | |||
6ec26363a1 | |||
7c9ea635ce | |||
89821185a8 | |||
c582e6f47a | |||
68494d9e09 | |||
a4b7025c07 | |||
1b884c771a | |||
24c6a4d764 | |||
773879425c | |||
e8a6de078a | |||
41f9f0a4dd | |||
e8886b53ad | |||
04a6d36110 | |||
cdef92e8fa | |||
28bf13b137 | |||
33544d3e90 |
3 changed files with 5 additions and 51 deletions
|
@ -8,7 +8,7 @@ COPY . /git/
|
|||
RUN find . -type d -name .git -exec git describe --always --dirty > /git-version.txt \;
|
||||
|
||||
|
||||
FROM python:3.12
|
||||
FROM python:3.13
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
|
46
app.py
46
app.py
|
@ -18,26 +18,6 @@ from gitmgr import GitManagerConfiguration, GitManager
|
|||
startup_timestamp = datetime.now()
|
||||
|
||||
|
||||
class AuthenticatedHandler(tornado.web.RequestHandler, metaclass=ABCMeta):
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def initialize(self, auth_provider=None):
|
||||
self.auth_provider = auth_provider
|
||||
|
||||
def prepare(self):
|
||||
if self.auth_provider is None:
|
||||
return
|
||||
|
||||
# check authentication
|
||||
auth_hdr = "Authentication"
|
||||
if auth_hdr not in self.request.headers:
|
||||
raise tornado.web.HTTPError(401, reason="authentication not provided")
|
||||
|
||||
tk = self.request.headers[auth_hdr]
|
||||
|
||||
if not self.auth_provider.validate_token(tk):
|
||||
raise tornado.web.HTTPError(403, reason="invalid authentication token provided")
|
||||
|
||||
|
||||
class HealthHandler(tornado.web.RequestHandler, metaclass=ABCMeta):
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def initialize(self, sources=None):
|
||||
|
@ -97,38 +77,12 @@ class Oas3Handler(tornado.web.RequestHandler, metaclass=ABCMeta):
|
|||
self.finish()
|
||||
|
||||
|
||||
class AllEntitiesHandler(AuthenticatedHandler, metaclass=ABCMeta):
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def initialize(self, auth_provider=None):
|
||||
super().initialize(auth_provider)
|
||||
|
||||
def post(self):
|
||||
pass
|
||||
|
||||
def get(self):
|
||||
pass
|
||||
|
||||
|
||||
class SingleEntityHandler(AuthenticatedHandler, metaclass=ABCMeta):
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def initialize(self, auth_provider=None):
|
||||
super().initialize(auth_provider)
|
||||
|
||||
def post(self, identifier):
|
||||
pass
|
||||
|
||||
def get(self, identifier):
|
||||
pass
|
||||
|
||||
|
||||
def make_app(_auth_provider=None, gitmgr=None):
|
||||
version_path = r"/v[0-9]"
|
||||
return tornado.web.Application([
|
||||
(version_path + r"/health", HealthHandler,
|
||||
{"sources": [lambda: {"git-head": gitmgr.head_sha}] if gitmgr else None}),
|
||||
(version_path + r"/oas3", Oas3Handler),
|
||||
(version_path + r"/entities", AllEntitiesHandler, {"auth_provider": _auth_provider}),
|
||||
(version_path + r"/entity/{.*}", SingleEntityHandler, {"auth_provider": _auth_provider}),
|
||||
])
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tornado==6.3.3
|
||||
isodate==0.6.1
|
||||
pytest==7.4.3
|
||||
GitPython==3.1.40
|
||||
tornado==6.4.1
|
||||
isodate==0.7.2
|
||||
pytest==8.3.3
|
||||
GitPython==3.1.43
|
Loading…
Reference in a new issue