An ebook/comic library service and web client
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
764 B

"""User API blueprint and endpoint definitions."""
from flask import Blueprint, abort
from atheneum.api.decorators import return_json
from atheneum.api.model import APIResponse
from atheneum.middleware import authentication_middleware
from atheneum.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)