fix(controller/user/session): return 401 upon authentication error

This commit is contained in:
Tiara Rodney 2022-04-16 06:28:10 +02:00
parent b69158241a
commit a5e61f9c5c

View file

@ -2,7 +2,7 @@
""" """
from flask import current_app from flask import current_app
from httpaste.helper.http import ForbiddenError from httpaste.helper.http import UnauthorizedError
from httpaste.model.user import authenticate, AuthenticationError from httpaste.model.user import authenticate, AuthenticationError
from httpaste.backend import load_backend from httpaste.backend import load_backend
@ -22,4 +22,11 @@ def post(*args, **kwargs):
return authenticate(user_id, password, backend.user, context) return authenticate(user_id, password, backend.user, context)
except AuthenticationError as e: except AuthenticationError as e:
raise ForbiddenError('You shall not pass!') from e raise UnauthorizedError('You shall not pass!') from e
def delete(**kwargs):
"""
"""
raise UnauthorizedError('Authentication Rejection requested by client')