rs-identity-model 0.8.2

Production-grade, RFC-compliant OIDC/OAuth2 client library for Rust
Documentation
//! # identity-model
//!
//! Production-grade, RFC-compliant OIDC/OAuth2 **client** library for Rust —
//! part of the cross-language [identity-model](https://github.com/jamescrowley321/identity-model)
//! family that shares one conformance specification across languages.
//!
//! ## Status
//!
//! The Core tier — discovery, JWKS retrieval and key resolution, JWT
//! validation (including the OIDC ID-token profile), client-credentials and
//! authorization-code + PKCE token flows, and UserInfo — is implemented, as is
//! Extended token introspection (RFC 7662), revocation (RFC 7009), the token
//! exchange grant (RFC 8693), and the key/proof/verify half of DPoP
//! (RFC 9449 — see [`dpop`] for what is not yet covered). Behavior is proven
//! against the cross-language conformance vectors in the repository's `spec/`.
//!
//! ## Module Overview
//!
//! - [`discovery`] — OIDC Discovery client
//! - [`jwks`] — JWKS fetch + key resolution
//! - [`jwt`] — JWT signature + claims validation, ID token validation
//! - [`token`] — client credentials, authorization code, PKCE, token exchange
//! - [`introspection`] — token introspection (RFC 7662)
//! - [`revocation`] — token revocation (RFC 7009)
//! - [`dpop`] — DPoP sender-constrained tokens (RFC 9449)
//! - [`userinfo`] — UserInfo endpoint client
//! - [`error`] — the crate error type, [`IdentityError`]

pub mod discovery;
pub mod dpop;
pub mod error;
pub mod introspection;
pub mod jwks;
pub mod jwt;
pub mod revocation;
pub mod token;
pub mod userinfo;

/// Shared client-authentication and HTTP-form helpers (client_secret_basic /
/// _post encoding, capped body reads, OAuth error bodies). Internal.
mod client_auth;

/// Shared HTTP client construction (redirect-downgrade defence). Internal.
mod http;

/// Internal helpers for reading numeric configuration from the environment.
mod env;

pub use discovery::{DiscoveryClient, DiscoveryClientBuilder, DiscoveryError, ProviderMetadata};
pub use dpop::{
    DPOP_PROOF_TYP, DpopAlgorithm, DpopKey, DpopProof, DpopProofOptions, DpopVerifyOptions,
    ath as dpop_ath, jwk_thumbprint, normalize_htu as dpop_normalize_htu, verify_bound_proof,
    verify_proof,
};
pub use error::IdentityError;
pub use http::secure_client_builder;
pub use introspection::{
    Introspection, IntrospectionAudience, IntrospectionClient, IntrospectionClientBuilder,
};
pub use jwks::{JsonWebKey, JsonWebKeySet, JwksClient, JwksClientBuilder};
pub use jwt::{
    Audience, BoxedClaimsValidator, Claims, ClaimsValidationError, ClaimsValidator, CombineMode,
    CombinedValidator, DEFAULT_ALLOWED_ALGORITHMS, IdTokenValidationOptions,
    IdTokenValidationOptionsBuilder, ValidationOptions, ValidationOptionsBuilder, boxed,
    combine_claims_validators, from_fn, require_claim_value, require_claims, require_scopes,
    validate_id_token, validate_id_token_claims, validate_token, validate_token_with_jwks,
};
pub use revocation::{RevocationClient, RevocationClientBuilder};
pub use token::{
    ClientAuthMethod, PkceChallenge, TOKEN_TYPE_ACCESS_TOKEN, TOKEN_TYPE_ID_TOKEN, TOKEN_TYPE_JWT,
    TOKEN_TYPE_REFRESH_TOKEN, TOKEN_TYPE_SAML1, TOKEN_TYPE_SAML2, TOKEN_TYPE_URIS, TokenClient,
    TokenClientBuilder, TokenExchangeRequest, TokenResponse, authorization_url,
};
pub use userinfo::{Address, UserInfoClient, UserInfoClientBuilder, UserInfoResponse};

/// Convenience alias for results returned across the crate.
pub type Result<T> = std::result::Result<T, IdentityError>;