Skip to content
Open
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
18 changes: 16 additions & 2 deletions packages/api/src/microsoft_teams/api/auth/json_web_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,27 @@ class JsonWebToken(TokenProtocol):

def __init__(self, value: str):
"""
Initialize JWT from token string.
Initialize a typed accessor over an already-validated JWT payload.

This constructor performs no signature verification, no issuer/audience
checks, and no expiry enforcement. Constructing it from an untrusted
token does NOT establish trust in the contained claims.

Signature verification happens at the HTTP trust boundary via
``TokenValidator.validate_token`` (packages/apps/src/microsoft_teams/
apps/auth/token_validator.py). Internal callers may also construct from
tokens sourced from trusted identity infrastructure (MSAL, Bot Framework
API responses).
Comment on lines +44 to +47

Callers must not construct this class from raw network input.

Args:
value: The JWT token string.
"""
self._value = value
# Decode without verification for payload extraction
# Decode without verification for payload extraction.
# Signature verification happens upstream in TokenValidator; see the
# class docstring for the trust-boundary contract.
Comment on lines +55 to +57
self._payload = JsonWebTokenPayload(
**jwt.decode(value, algorithms=["RS256"], options={"verify_signature": False})
)
Expand Down
Loading