mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-19 04:58:09 +00:00
log the TokenData and URL on rejecting tokens (#69)
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
import logging
|
||||||
from typing import Callable, Union
|
from typing import Callable, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
@ -66,6 +67,12 @@ def verify_token(
|
|||||||
return not_ok(token, status_code=401, context="token verification")
|
return not_ok(token, status_code=401, context="token verification")
|
||||||
|
|
||||||
if not is_authorized(token):
|
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(
|
return not_ok(
|
||||||
Error(code=ErrorCode.UNAUTHORIZED, errors=["Unrecognized agent"]),
|
Error(code=ErrorCode.UNAUTHORIZED, errors=["Unrecognized agent"]),
|
||||||
status_code=401,
|
status_code=401,
|
||||||
|
Reference in New Issue
Block a user