Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion monitoring/monitorlib/auth_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class Authorization(NamedTuple):
client_id: str
scopes: list[str]
issuer: str
issuer: str | None


class InvalidScopeError(Exception):
Expand Down Expand Up @@ -99,6 +99,7 @@ def wrapper(*args, **kwargs):
client_id = (
r["client_id"] if "client_id" in r else r.get("sub", None)
)
assert isinstance(client_id, str)
except jwt.ImmatureSignatureError:
raise InvalidAccessTokenError("Access token is immature.")
except jwt.ExpiredSignatureError:
Expand All @@ -114,6 +115,7 @@ def wrapper(*args, **kwargs):
f"Unexpected InvalidTokenError: {str(e)}"
)
issuer = r.get("iss", None)
assert isinstance(issuer, str) or issuer is None
flask.request.jwt = Authorization(
client_id, provided_scopes, issuer
)
Expand Down
18 changes: 9 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading