pub struct Claims<S: ScopeSet> {
pub iss: String,
pub sub: String,
pub aud: Vec<String>,
pub exp: i64,
pub iat: i64,
pub nonce: String,
pub azp: Option<String>,
pub auth_time: Option<i64>,
pub acr: Option<String>,
pub amr: Option<Vec<String>>,
/* private fields */
}Expand description
Verified id_token payload. S: ScopeSet is the type-level scope
witness — the engine sets it to the scope struct matching the
requested OAuth scope parameter, and the resulting value’s PII
accessors are bounded by S’s implemented marker traits.
── M72 acceptance evidence (RFC §6.11.1 D2) ────────────────────────────
Calling .email() on a Claims<Openid> is a compile error, not a
runtime check. The doc-test below is the standing acceptance fixture
for the type-level enforcement invariant — cargo test --doc -p ppoppo-token runs it and asserts the snippet fails to compile.
use ppoppo_token::id_token::Claims;
use ppoppo_token::id_token::scopes::Openid;
fn _compile_fail(c: &Claims<Openid>) -> &str {
c.email() // ERROR: method `email` not in scope (requires HasEmail)
}Granting the email scope at issuance time satisfies the bound:
use ppoppo_token::id_token::Claims;
use ppoppo_token::id_token::scopes::Email;
fn _compiles(c: &Claims<Email>) -> &str { c.email() }Fields§
§iss: String§sub: String§aud: Vec<String>§exp: i64§iat: i64§nonce: StringConditionally required: present iff the RP sent nonce in the
auth request. Engine-side: VerifyConfig::id_token requires an
expected_nonce, so reaching the engine implies nonce is
expected; M66 fires when this field is empty after parsing.
azp: Option<String>azp (authorized party) — OIDC §2. Set when the audience is
multi-valued; the M69 gate (Phase 10.5) verifies it equals the
RP’s client_id when aud.len() > 1.
auth_time: Option<i64>auth_time — when the End-User authentication occurred. Required
when the max_age request parameter or auth_time essential
claim was sent; surfaced unconditionally so the M70 gate (Phase
10.6) can read it.
acr: Option<String>acr — Authentication Context Class Reference. OIDC §2.
amr: Option<Vec<String>>amr — Authentication Methods References (e.g. ["pwd", "mfa"]).
Implementations§
Source§impl<S: HasEmail> Claims<S>
email scope — OIDC §5.4.
impl<S: HasEmail> Claims<S>
email scope — OIDC §5.4.
Sourcepub fn email(&self) -> &str
pub fn email(&self) -> &str
email is REQUIRED if the issuer emits the email scope at all
(OIDC §5.4). Engine deserialization populates Some(_) when
the wire contains the claim; the accessor unwraps via
expect() because reaching this method bound (S: HasEmail)
already proves the IdP honored the scope. A missing email on a
HasEmail token is an issuer drift, surfaced as a panic so the
regression is loud — if this path is reachable in production.
Phase 10.8 (M72) will replace expect with a verify-time
rejection so the panic becomes structurally unreachable.
pub fn email_verified(&self) -> Option<bool>
Source§impl<S: HasProfile> Claims<S>
profile scope — OIDC §5.4 (name / locale / updated_at family).
impl<S: HasProfile> Claims<S>
profile scope — OIDC §5.4 (name / locale / updated_at family).
pub fn name(&self) -> Option<&str>
pub fn given_name(&self) -> Option<&str>
pub fn family_name(&self) -> Option<&str>
pub fn middle_name(&self) -> Option<&str>
pub fn nickname(&self) -> Option<&str>
pub fn preferred_username(&self) -> Option<&str>
pub fn profile(&self) -> Option<&str>
pub fn picture(&self) -> Option<&str>
pub fn website(&self) -> Option<&str>
pub fn gender(&self) -> Option<&str>
pub fn birthdate(&self) -> Option<&str>
pub fn zoneinfo(&self) -> Option<&str>
pub fn locale(&self) -> Option<&str>
pub fn updated_at(&self) -> Option<i64>
Source§impl<S: HasPhone> Claims<S>
phone scope — OIDC §5.4.
impl<S: HasPhone> Claims<S>
phone scope — OIDC §5.4.
pub fn phone_number(&self) -> Option<&str>
pub fn phone_number_verified(&self) -> Option<bool>
Source§impl<S: HasAddress> Claims<S>
address scope — OIDC §5.4 (single structured claim).
impl<S: HasAddress> Claims<S>
address scope — OIDC §5.4 (single structured claim).