A multipurpose python flask API server and administration SPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
756 B

"""User API blueprint and endpoint definitions."""
from flask import Blueprint, abort
from corvus.api.decorators import return_json
from corvus.api.model import APIResponse
from corvus.middleware import authentication_middleware
from corvus.service import user_service
USER_BLUEPRINT = Blueprint(
name='user', import_name=__name__, url_prefix='/user')
@USER_BLUEPRINT.route('/<name>', methods=['GET'])
@return_json
@authentication_middleware.require_token_auth
def get_user(name: str) -> APIResponse:
"""
Get a token for continued authentication.
:return: A login token for continued authentication
"""
user = user_service.find_by_name(name)
if user is not None:
return APIResponse(user, 200)
return abort(404)