pub struct OAuthValidator { /* private fields */ }Implementations§
Source§impl OAuthValidator
impl OAuthValidator
Sourcepub fn with_verifier(
config: OAuthConfig,
verifier: Box<dyn Fn(&Jwk, &[u8], &[u8]) -> Result<(), String> + Send + Sync>,
) -> OAuthValidator
pub fn with_verifier( config: OAuthConfig, verifier: Box<dyn Fn(&Jwk, &[u8], &[u8]) -> Result<(), String> + Send + Sync>, ) -> OAuthValidator
Construct a validator with an explicit signature verifier.
Tests pass a closure that always returns Ok(()); production
code plugs a real RS256 / ES256 verifier.
Sourcepub fn set_jwks(&self, keys: Vec<Jwk>)
pub fn set_jwks(&self, keys: Vec<Jwk>)
Replace the JWKS cache. Called by the initial fetch + the periodic refresh loop. Tests seed known keys directly.
pub fn config(&self) -> &OAuthConfig
Sourcepub fn extract_bearer(&self, header_value: &str) -> Option<String>
pub fn extract_bearer(&self, header_value: &str) -> Option<String>
Extract a bearer token from an Authorization header value, or
None when the header isn’t bearer-style.
Sourcepub fn validate<F>(
&self,
token: &DecodedJwt,
now_unix_secs: i64,
lookup_user: F,
) -> Result<OAuthIdentity, OAuthError>
pub fn validate<F>( &self, token: &DecodedJwt, now_unix_secs: i64, lookup_user: F, ) -> Result<OAuthIdentity, OAuthError>
Validate a decoded token. now_unix_secs is injected so the
caller controls the clock (tests freeze time; production passes
SystemTime::now).
Auto Trait Implementations§
impl !Freeze for OAuthValidator
impl !RefUnwindSafe for OAuthValidator
impl Send for OAuthValidator
impl Sync for OAuthValidator
impl Unpin for OAuthValidator
impl UnsafeUnpin for OAuthValidator
impl !UnwindSafe for OAuthValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request