Upload files to "/"

Upload to GIT
This commit is contained in:
chris 2025-03-10 23:11:08 +00:00
parent a74e13ec87
commit dd77c09b60
4 changed files with 73 additions and 2 deletions

View File

@ -1,2 +1 @@
# WAC
# WebAppCommon

26
__init__.py Normal file
View File

@ -0,0 +1,26 @@
from flask_jwt_extended import decode_token
from user_managment.models import User
from auth.jwt_controller import jwt
from auth import login
@login.request_loader
def load_person_from_request(request):
try:
token = request.json['access_token']
except Exception:
return None
data = decode_token(token)
user = User.objects(user_name=data['sub']).first()
if user:
return user
return None
def init_app(app):
jwt.init_app(app)
login.init_app(app)
return app

19
config.py Normal file
View File

@ -0,0 +1,19 @@
import os
def config_from_environ(app, prefix=None):
if not prefix:
prefix = app.config.get('APP_NAME')
for name, value in os.environ.items():
if name.startswith(prefix):
if isinstance(value, str):
value = value.strip()
if value:
app.config[name[len(prefix) + 1:]] = value
class BaseConfig:
JWT_TOKEN_LOCATION = 'json'
JWT_IDENTITY_CLAIM = 'sub'

27
requirements.txt Normal file
View File

@ -0,0 +1,27 @@
web3==5.16.0
flask==1.1.2
flask-restx==0.2.0
wtforms==2.3.3
pymongo==3.11.3
flask-mongoengine==1.0.0
mongoengine==0.23.0
uwsgi==2.0.19.1
werkzeug==1.0.1
pyjwt==2.0.1
flask-jwt-extended==4.0.2
google-api-python-client==1.12.8
google-auth==1.27.0
google-api-core==1.26.0
google-auth-httplib2==0.0.4
googleapis-common-protos==1.53.0
requests==2.25.1
flask-cors==3.0.10
pytest==6.2.2
pytest-mock==3.5.1
jsonschema==3.2.0
jsonref==0.2
mongomock==3.22.1
deepdiff==5.2.3
coverage==5.5
flask-login==0.5.0
redis==4.1.3