pub struct UnsecuredJwsValidator {
pub principal_claim_name: String,
pub allowable_clock_skew_ms: i64,
pub custom_claim_check: Option<JpQuery>,
pub valid_token_type: 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
Validates an unsecured JWS bearer token (alg: none) and derives the
connection principal. Mirrors Kafka’s
OAuthBearerUnsecuredValidatorCallbackHandler.
Fields§
§principal_claim_name: StringClaim whose string value becomes the principal name. Default sub.
allowable_clock_skew_ms: i64Tolerance, in milliseconds, applied to the exp / iat temporal
checks to absorb clock drift between the client and broker.
custom_claim_check: Option<JpQuery>Precompiled JsonPath expression evaluated against the
token’s claim set. Token is rejected when the expression yields
empty/null/false. Compile once at validator construction.
valid_token_type: Option<String>When set, the JWT typ header field must equal this
string. Ignored when unset.
fallback_user_name_claim: Option<String>Alternate claim name to read the principal name from
when principal_claim_name is absent or empty. Strimzi’s
“service-account fallback” — sub typically holds a UUID,
client_id is the readable name.
fallback_user_name_prefix: Option<String>Prepended to the resolved principal name ONLY when the fallback claim fires. Strimzi convention: “service-account-”.
groups_claim: Option<JpQuery>Precompiled JsonPath expression extracting group
memberships from the token claims. Compile-once-at-startup.
groups_claim_delimiter: Option<String>When groups_claim resolves to a string (not an
array), split on this delimiter. Common: “,” or “ “.
Implementations§
Source§impl UnsecuredJwsValidator
impl UnsecuredJwsValidator
Sourcepub fn validate(
&self,
token: &str,
now_ms: i64,
) -> Result<AuthOutcome, AuthError>
pub fn validate( &self, token: &str, now_ms: i64, ) -> Result<AuthOutcome, AuthError>
Validate token against now_ms (Unix epoch milliseconds), returning
the authenticated Principal on success.
§Errors
AuthError::InvalidToken for any structural, signature, temporal,
scope, or principal-claim failure. The caller maps this onto the RFC
7628 invalid_token server error status.
Trait Implementations§
Source§impl Clone for UnsecuredJwsValidator
impl Clone for UnsecuredJwsValidator
Source§fn clone(&self) -> UnsecuredJwsValidator
fn clone(&self) -> UnsecuredJwsValidator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UnsecuredJwsValidator
impl Debug for UnsecuredJwsValidator
Source§impl Default for UnsecuredJwsValidator
impl Default for UnsecuredJwsValidator
Source§impl PartialEq for UnsecuredJwsValidator
impl PartialEq for UnsecuredJwsValidator
Source§fn eq(&self, other: &UnsecuredJwsValidator) -> bool
fn eq(&self, other: &UnsecuredJwsValidator) -> bool
self and other values to be equal, and is used by ==.