mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
fix: use explicit None checks for JWT exp validation (#3724)
This commit is contained in:
parent
5be249ada3
commit
61f3feec6a
3 changed files with 4 additions and 4 deletions
|
|
@ -246,7 +246,7 @@ class JWTIssuer:
|
|||
|
||||
# Validate expiration
|
||||
exp = payload.get("exp")
|
||||
if exp and exp < time.time():
|
||||
if exp is not None and exp < time.time():
|
||||
logger.debug("Token expired")
|
||||
raise JoseError("Token has expired")
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ class IntrospectionTokenVerifier(TokenVerifier):
|
|||
token=token,
|
||||
client_id=str(client_id),
|
||||
scopes=scopes,
|
||||
expires_at=int(exp) if exp else None,
|
||||
expires_at=int(exp) if exp is not None else None,
|
||||
claims=introspection_data, # Store full response for extensibility
|
||||
)
|
||||
self._cache.set(token, result)
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ class JWTVerifier(TokenVerifier):
|
|||
|
||||
# Validate expiration
|
||||
exp = claims.get("exp")
|
||||
if exp and exp < time.time():
|
||||
if exp is not None and exp < time.time():
|
||||
self.logger.debug(
|
||||
"Token validation failed: expired token for client %s", client_id
|
||||
)
|
||||
|
|
@ -501,7 +501,7 @@ class JWTVerifier(TokenVerifier):
|
|||
token=token,
|
||||
client_id=str(client_id),
|
||||
scopes=scopes,
|
||||
expires_at=int(exp) if exp else None,
|
||||
expires_at=int(exp) if exp is not None else None,
|
||||
claims=claims,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue