pub struct OidcProviderFn<F> { /* private fields */ }Expand description
OidcProvider backed by a user-supplied async closure.
The closure fires on every federation — initial auth and every
re-federation after expiry — so it must return the current JWT each
time, not a value captured once. The point of the closure is to defer to
the provider’s own session machinery on every call: a provider SDK
(clerk.session.getToken(), supabase.auth.getSession()) hands back a
freshly-minted short-lived JWT, transparently refreshing its own session
as needed. Capturing a single token up front would instead pin a JWT that
expires and can never be renewed.
§Example
use stack_auth::{AuthError, OidcProviderFn, SecretToken};
// Each call asks the provider SDK for the *current* session token, so an
// expired JWT is refreshed upstream rather than reused.
let provider = OidcProviderFn::new(|| async {
let jwt = clerk_session_get_token().await?;
Ok::<_, AuthError>(SecretToken::new(jwt))
});Implementations§
Source§impl<F> OidcProviderFn<F>
impl<F> OidcProviderFn<F>
Trait Implementations§
Source§impl<F, Fut> OidcProvider for OidcProviderFn<F>
Available on non-WebAssembly only.
impl<F, Fut> OidcProvider for OidcProviderFn<F>
Available on non-WebAssembly only.
Auto Trait Implementations§
impl<F> Freeze for OidcProviderFn<F>where
F: Freeze,
impl<F> RefUnwindSafe for OidcProviderFn<F>where
F: RefUnwindSafe,
impl<F> Send for OidcProviderFn<F>where
F: Send,
impl<F> Sync for OidcProviderFn<F>where
F: Sync,
impl<F> Unpin for OidcProviderFn<F>where
F: Unpin,
impl<F> UnsafeUnpin for OidcProviderFn<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for OidcProviderFn<F>where
F: UnwindSafe,
Blanket Implementations§
impl<T> AuthStrategyBounds for T
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 more