Decodes and validates LTI ID Tokens (JWTs).
Implements the
Authentication Response Validation
steps from the IMS Security Framework. The module verifies the JWT signature
using the platform's public key (fetched via Ltix.JWT.KeySet), enforces
RS256-only signing, and validates all required claims.
Critical header extensions (RFC 7515 §4.1.11) are not supported.
Examples
{:ok, claims} = Ltix.JWT.Token.verify(token_string, registration)Validation Steps
- Decode the JWT header to extract
algandkid - Reject any algorithm other than RS256
- Fetch the platform's public key by
kidviaLtix.JWT.KeySet - Verify the RS256 signature
- Validate
issmatches the registration's issuer - Validate
audis the tool'sclient_id, or a list containing only it - Validate
azpmatchesclient_id(when present) - Validate
iatis a NumericDate that is not in the future - Validate
nbfis not in the future (when present) - Validate
expis not in the past andiatis within the maximum token age - Validate
nonceis present
Steps 8 to 10 allow for clock skew.
Options
:clock_skew- seconds of tolerance forexp,iat, andnbfvalidation (defaults to5):max_token_age- seconds afteriatthat a token is still accepted, or:infinityto accept any age (defaults to application config, then3600):now- override current time in unix seconds (useful for testing):req_options- extra options passed through toLtix.JWT.KeySet:key_set- key set name passed through toLtix.JWT.KeySet:local_network_access- passed through toLtix.JWT.KeySet
Summary
Functions
Verify and decode an LTI ID Token.
Functions
@spec verify(String.t(), Ltix.Registration.t(), keyword()) :: {:ok, claims :: map()} | {:error, Exception.t()}
Verify and decode an LTI ID Token.
Implements the validation steps from Sec §5.1.3.
Returns {:ok, claims} with the decoded claims map on success, or
{:error, exception} on any validation failure.