Skip to main content

Crate rs_identity_model

Crate rs_identity_model 

Source
Expand description

§identity-model

Production-grade, RFC-compliant OIDC/OAuth2 client library for Rust — part of the cross-language 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

Re-exports§

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

Modules§

discovery
OIDC Discovery client: fetch, validate, and cache provider metadata.
dpop
DPoP — Demonstrating Proof of Possession at the Application Layer (RFC 9449): binds an access token to a client-held key pair, so a stolen token cannot be replayed by an attacker who does not hold the private key.
error
Crate-wide error type for identity-model.
introspection
OAuth 2.0 token introspection client (RFC 7662).
jwks
JWKS client: fetch, cache, and resolve JSON Web Keys by kid.
jwt
JWT validation: verify JWS signatures and registered claims.
revocation
OAuth 2.0 Token Revocation (RFC 7009).
token
Token endpoint client: client credentials, authorization code, PKCE, token exchange.
userinfo
UserInfo endpoint client: fetch profile claims, verify sub consistency.

Functions§

secure_client_builder
Returns a reqwest::ClientBuilder carrying this crate’s redirect hardening, so a caller who needs their own client does not silently lose it.

Type Aliases§

Result
Convenience alias for results returned across the crate.