tina4-python 0.2.114__tar.gz → 0.2.115__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tina4_python-0.2.114 → tina4_python-0.2.115}/PKG-INFO +1 -1
- {tina4_python-0.2.114 → tina4_python-0.2.115}/pyproject.toml +1 -1
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Router.py +38 -13
- {tina4_python-0.2.114 → tina4_python-0.2.115}/.gitignore +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/README.md +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Database.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/DatabaseResult.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/DatabaseTypes.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Debug.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/MiddleWare.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/ORM.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Queue.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Request.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Response.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Swagger.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Webserver.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/Websocket.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/__init__.py +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/images/500.png +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/js/reconnecting-websocket.js +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/templates/errors/500.twig +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
|
@@ -73,6 +73,7 @@ class Router:
|
|
|
73
73
|
tina4_python.tina4_current_request["url"] = url
|
|
74
74
|
tina4_python.tina4_current_request["headers"] = headers
|
|
75
75
|
|
|
76
|
+
validated = False
|
|
76
77
|
# we can add other methods later but right now we validate posts
|
|
77
78
|
if method in [Constant.TINA4_GET, Constant.TINA4_POST, Constant.TINA4_PUT, Constant.TINA4_PATCH,
|
|
78
79
|
Constant.TINA4_DELETE]:
|
|
@@ -86,7 +87,6 @@ class Router:
|
|
|
86
87
|
content = Template.render_twig_template(
|
|
87
88
|
"errors/403.twig", {"server": {"url": url}})
|
|
88
89
|
|
|
89
|
-
validated = False
|
|
90
90
|
# check to see if we have an auth ability
|
|
91
91
|
if "authorization" in headers:
|
|
92
92
|
token = headers["authorization"].replace("Bearer", "").strip()
|
|
@@ -103,12 +103,9 @@ class Router:
|
|
|
103
103
|
if tina4_python.tina4_auth.valid(token):
|
|
104
104
|
validated = True
|
|
105
105
|
|
|
106
|
-
if not
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if request["body"] is not None and "formToken" in request["body"]:
|
|
110
|
-
request["params"]["formToken"] = request["body"]["formToken"]
|
|
111
|
-
del request["body"]["formToken"]
|
|
106
|
+
if request["body"] is not None and "formToken" in request["body"]:
|
|
107
|
+
request["params"]["formToken"] = request["body"]["formToken"]
|
|
108
|
+
del request["body"]["formToken"]
|
|
112
109
|
|
|
113
110
|
# split URL and extract query string
|
|
114
111
|
url_parts = url.split('?')
|
|
@@ -129,16 +126,19 @@ class Router:
|
|
|
129
126
|
continue
|
|
130
127
|
Debug("Matching route " + route['route'] + " to " + url, Constant.TINA4_LOG_DEBUG)
|
|
131
128
|
if Router.match(url, route['route']):
|
|
132
|
-
if
|
|
133
|
-
if route
|
|
134
|
-
|
|
129
|
+
if not "noauth" in route:
|
|
130
|
+
if "secure" in route or ("swagger" in route and route["swagger"] is not None and "secure" in route["swagger"]):
|
|
131
|
+
if (("secure" in route and route["secure"]) or ("swagger" in route and route["swagger"] is not None and route["swagger"]["secure"])) and not validated:
|
|
132
|
+
return Response.Response(content, Constant.HTTP_FORBIDDEN, Constant.TEXT_HTML)
|
|
133
|
+
else:
|
|
134
|
+
if not validated:
|
|
135
|
+
return Response.Response(content, Constant.HTTP_FORBIDDEN, Constant.TEXT_HTML)
|
|
135
136
|
|
|
136
137
|
router_response = route["callback"]
|
|
137
138
|
|
|
138
|
-
# Add the inline variables
|
|
139
|
+
# Add the inline variables & construct a Request variable
|
|
139
140
|
request["params"].update(Router.variables)
|
|
140
141
|
|
|
141
|
-
|
|
142
142
|
Request.request = request # Add the request object
|
|
143
143
|
Request.headers = headers # Add the headers
|
|
144
144
|
Request.params = request["params"]
|
|
@@ -152,7 +152,6 @@ class Router:
|
|
|
152
152
|
Request.transport = request["transport"] if "transport" in request else None
|
|
153
153
|
Request.asgi_response = request["asgi_response"] if "asgi_response" in request else None
|
|
154
154
|
|
|
155
|
-
|
|
156
155
|
tina4_python.tina4_current_request = Request
|
|
157
156
|
|
|
158
157
|
old_stdout = sys.stdout # Memorize the default stdout stream
|
|
@@ -396,3 +395,29 @@ def middleware(middleware, specific_methods=[]):
|
|
|
396
395
|
return callback
|
|
397
396
|
|
|
398
397
|
return actual_middleware
|
|
398
|
+
|
|
399
|
+
def secured():
|
|
400
|
+
"""
|
|
401
|
+
Makes a route secure - secured vs secure with swagger
|
|
402
|
+
:return:
|
|
403
|
+
"""
|
|
404
|
+
def actual_secure(callback):
|
|
405
|
+
if callback not in tina4_python.tina4_routes:
|
|
406
|
+
tina4_python.tina4_routes[callback] = {}
|
|
407
|
+
tina4_python.tina4_routes[callback]["secure"] = True
|
|
408
|
+
return callback
|
|
409
|
+
|
|
410
|
+
return actual_secure
|
|
411
|
+
|
|
412
|
+
def noauth():
|
|
413
|
+
"""
|
|
414
|
+
Defines a route with no auth
|
|
415
|
+
:return:
|
|
416
|
+
"""
|
|
417
|
+
def actual_noauth(callback):
|
|
418
|
+
if callback not in tina4_python.tina4_routes:
|
|
419
|
+
tina4_python.tina4_routes[callback] = {}
|
|
420
|
+
tina4_python.tina4_routes[callback]["noauth"] = True
|
|
421
|
+
return callback
|
|
422
|
+
|
|
423
|
+
return actual_noauth
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/js/reconnecting-websocket.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/public/swagger/oauth2-redirect.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/en/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/fr/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.114 → tina4_python-0.2.115}/tina4_python/translations/fr/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|