pub struct IntrospectionValidator {
pub client: Arc<dyn IntrospectionClient>,
pub principal_claim_name: String,
pub custom_claim_check: Option<JpQuery>,
pub call_userinfo: bool,
pub allowable_clock_skew_ms: i64,
pub expected_audience: Option<String>,
pub fallback_user_name_claim: Option<String>,
pub fallback_user_name_prefix: Option<String>,
pub groups_claim: Option<JpQuery>,
pub groups_claim_delimiter: Option<String>,
}Expand description
RFC 7662 opaque-token introspection validator. Calls the introspection endpoint per token (no caching — RFC 7662 §4 discourages caching without explicit lifetime info; SASL is once per connection so the cost is acceptable). Optionally calls OIDC userinfo after a successful introspection and merges the profile claims over the introspection claims.
Fields§
§client: Arc<dyn IntrospectionClient>§principal_claim_name: StringClaim whose string value becomes the principal name. Default sub
for generic OAuth flows; commonly client_id for Keycloak
client-credentials.
custom_claim_check: Option<JpQuery>Precompiled JsonPath custom_claim_check. See
UnsecuredJwsValidator for semantics. Introspection has no JWT
header, so there is no valid_token_type field here.
call_userinfo: booltrue iff a userinfo_endpoint_uri is configured; the validator
calls client.userinfo(token) after a successful introspection and
merges the response over the introspection claims.
allowable_clock_skew_ms: i64Clock-skew tolerance for exp/iat/nbf checks on
introspection-response timestamps (when present).
expected_audience: Option<String>When set, the introspection-response aud claim (RFC 7662 §2.2) must
contain this value. Defaults to None (no audience restriction).
Prevents a token minted for another resource server of the same IdP,
which still introspects as active: true, from authenticating here.
fallback_user_name_claim: Option<String>Alternate principal claim. See UnsecuredJwsValidator.
fallback_user_name_prefix: Option<String>Prepended to the principal name only on fallback.
groups_claim: Option<JpQuery>Precompiled JsonPath extracting group memberships,
evaluated against the merged claims (introspection + optional
userinfo).
groups_claim_delimiter: Option<String>Delimiter when groups_claim resolves to a string.
Implementations§
Source§impl IntrospectionValidator
impl IntrospectionValidator
Sourcepub async fn validate(
&self,
token: &str,
now_ms: i64,
) -> Result<AuthOutcome, AuthError>
pub async fn validate( &self, token: &str, now_ms: i64, ) -> Result<AuthOutcome, AuthError>
Validate a bearer token via RFC 7662 introspection + optional userinfo enrichment.
§Errors
AuthError::IntrospectionTransporton HTTP transport / parse failures.AuthError::InvalidTokenonactive != true, missingexp, missing principal claim, scope mismatch, or temporal-claim failure.expis required so the SASL handler can populatesession_lifetime_msfor KIP-368 re-authentication.
Trait Implementations§
Source§impl Clone for IntrospectionValidator
impl Clone for IntrospectionValidator
Source§fn clone(&self) -> IntrospectionValidator
fn clone(&self) -> IntrospectionValidator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more