Loading portal/rest/auth/login.py +5 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from portal import jwt from portal.service.auth import login_user, login_component from portal.service.errors import UnauthorizedError, PortalAPIError from portal.service import service from portal.tools.decorators import error_handler auth = Blueprint('auth', __name__, url_prefix='/auth') auth_api = Api(auth) Loading @@ -24,6 +25,7 @@ def add_claims_to_access_token(identity): # basic login - username + password (user) / name + secret (component) class Login(Resource): @error_handler def post(self): data = request.get_json() if not data.get('type'): Loading Loading @@ -58,6 +60,7 @@ class Login(Resource): class Refresh(Resource): @error_handler @jwt_refresh_token_required def post(self): client = get_jwt_identity() Loading @@ -72,6 +75,7 @@ class Refresh(Resource): class Logout(Resource): @error_handler @jwt_required def post(self): # TODO Loading @@ -85,7 +89,7 @@ class Logout(Resource): 'refresh_token': None } return jsonify(ret), 200 return ret, 200 auth_api.add_resource(Login, '/login') Loading Loading
portal/rest/auth/login.py +5 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from portal import jwt from portal.service.auth import login_user, login_component from portal.service.errors import UnauthorizedError, PortalAPIError from portal.service import service from portal.tools.decorators import error_handler auth = Blueprint('auth', __name__, url_prefix='/auth') auth_api = Api(auth) Loading @@ -24,6 +25,7 @@ def add_claims_to_access_token(identity): # basic login - username + password (user) / name + secret (component) class Login(Resource): @error_handler def post(self): data = request.get_json() if not data.get('type'): Loading Loading @@ -58,6 +60,7 @@ class Login(Resource): class Refresh(Resource): @error_handler @jwt_refresh_token_required def post(self): client = get_jwt_identity() Loading @@ -72,6 +75,7 @@ class Refresh(Resource): class Logout(Resource): @error_handler @jwt_required def post(self): # TODO Loading @@ -85,7 +89,7 @@ class Logout(Resource): 'refresh_token': None } return jsonify(ret), 200 return ret, 200 auth_api.add_resource(Login, '/login') Loading