automatically adding recorders, models and rooms and association of those

This commit is contained in:
2019-11-22 14:26:16 +01:00
parent 7700b4381f
commit c4b54357f7
9 changed files with 114 additions and 46 deletions

View File

@@ -15,6 +15,7 @@ from flask import Flask, jsonify
from flask_httpauth import HTTPTokenAuth, HTTPBasicAuth, MultiAuth
from flask_jwt_extended import JWTManager, decode_token
from flask_login import LoginManager
from flask_restplus import abort
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from backend.config import Config
@@ -128,10 +129,16 @@ login_manager.init_app(app)
# flask_jwt_extended: to be used usually by API
jwt_extended = JWTManager(app)
#
# this is another library.... this is (probaby ->verify) used to check JWTs provided by external sources (KIT, etc.)
jwt_auth = HTTPTokenAuth('Bearer')
@jwt_extended.invalid_token_loader
def unauthorized_jwt(token):
main_logger.info("Unauthorized access; invalid token provided: {}".format(token))
abort(401)
@jwt_auth.verify_token
def verify_token(token):
"""This function (and HTTPTokenAuth('Bearer')) has been defined to be used together with MultiAuth. For API calls