pub struct FallbackValidator<J: TokenValidator> { /* private fields */ }Expand description
Token validator that tries JWT validation first and falls back to introspection.
Useful when the authorization server issues both JWTs and opaque tokens. JWT validation is preferred (no network call) but introspection handles opaque tokens that can’t be decoded as JWTs.
Implementations§
Source§impl<J: TokenValidator> FallbackValidator<J>
impl<J: TokenValidator> FallbackValidator<J>
Sourcepub fn new(
jwt_validator: J,
introspection_validator: IntrospectionValidator,
) -> Self
pub fn new( jwt_validator: J, introspection_validator: IntrospectionValidator, ) -> Self
Create a fallback validator that tries jwt_validator first,
then introspection_validator if JWT validation fails.
Trait Implementations§
Source§impl<J: Clone + TokenValidator> Clone for FallbackValidator<J>
impl<J: Clone + TokenValidator> Clone for FallbackValidator<J>
Source§fn clone(&self) -> FallbackValidator<J>
fn clone(&self) -> FallbackValidator<J>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<J: TokenValidator> TokenValidator for FallbackValidator<J>
impl<J: TokenValidator> TokenValidator for FallbackValidator<J>
Source§async fn validate_token(&self, token: &str) -> Result<TokenClaims, OAuthError>
async fn validate_token(&self, token: &str) -> Result<TokenClaims, OAuthError>
Validate an access token and return the extracted claims. Read more
Auto Trait Implementations§
impl<J> Freeze for FallbackValidator<J>where
J: Freeze,
impl<J> !RefUnwindSafe for FallbackValidator<J>
impl<J> Send for FallbackValidator<J>
impl<J> Sync for FallbackValidator<J>
impl<J> Unpin for FallbackValidator<J>where
J: Unpin,
impl<J> UnsafeUnpin for FallbackValidator<J>where
J: UnsafeUnpin,
impl<J> !UnwindSafe for FallbackValidator<J>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more