Verify Identity Assertion JWT Authorization Grants (ID-JAGs) at the Resource Authorization Server.
The client redeems the ID-JAG at the token endpoint with the RFC 7523 §4 JWT-bearer authorization grant. The verifier checks the signature against a trusted JWKS supplied by the caller and returns the verified claims. The caller selects the issuer, prevents replay, and applies authorization policy. ID-JAG draft -06, §§3.1 and 4.4.1.
- The JOSE
typisoauth-id-jag+jwt, compared case-insensitively (RFC 7515 §4.1.9 and RFC 2045 §5.1). - The trusted issuer matches
iss. The expected audience is the sole value inaud, which may be a string or a one-element array. - The request client matches
client_id. iss,sub,aud,client_id,jti,exp, andiatare required.- The assertion must be unexpired. The verifier allows 60 seconds of skew
for
iatandnbfand checks the configured lifetime bound. - The verifier checks the types of optional claims and returns validated
authorization_detailsfor the caller to process under RFC 9396.
Summary
Functions
Maximum accepted wire size in bytes of a compact Identity Assertion (ID-JAG).
Decode the unverified claims of a size-bounded ID-JAG for issuer selection.
Read the unverified iss claim from an assertion so the caller can select the
trusted issuer (and its JWKS) before verifying the signature.
Sign an Identity Assertion JWT Authorization Grant as a trust domain A
authorization server (draft-ietf-oauth-identity-chaining-17 / RFC 10092;
draft-ietf-oauth-identity-assertion-authz-grant-06).
Verify an ID-JAG assertion against a trusted issuer JWKS and return its claims.
Types
The validated, string-keyed ID-JAG claim set.
@type verify_error() ::
:malformed
| :unsupported_critical_header
| :unsupported_alg
| :invalid_typ
| :invalid_signature
| :invalid_issuer
| :invalid_audience
| :missing_claim
| :invalid_claims
| :client_mismatch
| :expired
| :not_yet_valid
@type verify_opts() :: [ now: DateTime.t() | non_neg_integer(), issuer: String.t(), audience: String.t(), client_id: String.t(), accepted_algs: [Attesto.SigningAlg.alg()], max_lifetime_seconds: pos_integer() | nil ]
Functions
@spec max_assertion_bytes() :: pos_integer()
Maximum accepted wire size in bytes of a compact Identity Assertion (ID-JAG).
Decode the unverified claims of a size-bounded ID-JAG for issuer selection.
Use verify/3 with the selected trusted issuer before using any claim for
authorization.
Read the unverified iss claim from an assertion so the caller can select the
trusted issuer (and its JWKS) before verifying the signature.
This decodes the JWT payload WITHOUT verifying it - the returned issuer is
untrusted until verify/3 confirms the signature and re-checks iss against
the caller-supplied :issuer. Returns :error for a malformed JWT or an
absent/blank iss.
@spec sign(Attesto.Config.t(), map() | keyword(), keyword()) :: {:ok, String.t()} | {:error, :missing_claim | :invalid_claims}
Sign an Identity Assertion JWT Authorization Grant as a trust domain A
authorization server (draft-ietf-oauth-identity-chaining-17 / RFC 10092;
draft-ietf-oauth-identity-assertion-authz-grant-06).
Options:
:typ- JOSE headertypvalue. Defaults to"oauth-id-jag+jwt"for ID-JAG (urn:ietf:params:oauth:token-type:id-jag); pass"JWT"for a plain RFC 7523 authorization grant (urn:ietf:params:oauth:token-type:jwt).:now/:lifetime- clock override and assertion lifetime in seconds.
The issuer is always config.issuer. A supplied iss attribute must match;
a conflicting value returns {:error, :invalid_claims}.
@spec verify(String.t(), map() | [map()], verify_opts()) :: {:ok, claims()} | {:error, verify_error()}
Verify an ID-JAG assertion against a trusted issuer JWKS and return its claims.
trusted_jwks is the asserting IdP's JWK set (a %{"keys" => [...]} map, a
bare list of JWK maps, or a single JWK map). Required opts:
:issuer- the trusted issuer the assertion'sissmust equal.:audience- this server's issuer identifier the assertion'saudmust identify.:client_id- the authenticated client; theclient_idclaim must equal it (draft §3.1).
Optional opts:
:accepted_algs- JOSE algorithms a candidate key may sign with. Defaults toAttesto.SigningAlg.allowed/0(includes RS256, which enterprise IdPs commonly use - unlike the FAPI request-object default).:max_lifetime_seconds- reject an assertion whoseexp - iatexceeds this bound.:now- the verification instant (aDateTimeor unix seconds); defaults to the system clock.
Returns {:ok, claims} (string-keyed, including the registered claims) or
{:error, t:verify_error/0}. The caller maps every error to invalid_grant.