log the TokenData and URL on rejecting tokens (#69)

This commit is contained in:
bmc-msft
2020-10-01 16:23:49 -04:00
committed by GitHub
parent 22ee2975ef
commit 4089cbe176

View File

@ -3,6 +3,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
from typing import Callable, Union
from uuid import UUID
@ -66,6 +67,12 @@ def verify_token(
return not_ok(token, status_code=401, context="token verification")
if not is_authorized(token):
logging.error(
"rejecting token url:%s token:%s body:%s",
repr(req.url),
repr(token),
repr(req.get_body()),
)
return not_ok(
Error(code=ErrorCode.UNAUTHORIZED, errors=["Unrecognized agent"]),
status_code=401,