test(auth): make sync userinfo tests def; note defensive userinfo guard
Address claude-review round 6 (LGTM) nits on #919: - test_userinfo_token_cached_with_short_ttl and test_userinfo_token_with_exp_uses_real_expiry call only the sync _create_access_token_with_cache_key — declare them as plain def (no await). - Comment the userinfo_uri guard in _validate_via_userinfo as defensive / direct-call support (the management caller already gates on userinfo_uri). Left as-is: the hasattr(settings, "userinfo_uri") guard — kept to mirror the adjacent introspection_uri block (consistency requested in round 2). The _verify_mcp_audience metric-when-unconfigured note is a pre-existing, out-of- scope item for a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e1e9c9b918
commit
bc6595b139
@@ -651,6 +651,9 @@ class UnifiedTokenVerifier(TokenVerifier):
|
||||
Returns:
|
||||
Userinfo claims if valid, else None.
|
||||
"""
|
||||
# Defensive: the management-API caller already gates on
|
||||
# self.userinfo_uri before invoking this, but the guard keeps the method
|
||||
# safe to call directly (e.g. in unit tests).
|
||||
if not self.userinfo_uri:
|
||||
logger.debug("No userinfo endpoint configured")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user