pub struct ProxyProvider { /* private fields */ }Available on non-WebAssembly only.
Expand description
Proxy authentication provider that delegates to an upstream OAuth server.
This is similar to the TypeScript SDK’s ProxyProvider pattern.
Implementations§
Source§impl ProxyProvider
impl ProxyProvider
Sourcepub fn new(config: ProxyProviderConfig) -> Self
pub fn new(config: ProxyProviderConfig) -> Self
Create a new proxy provider with the given configuration.
Sourcepub fn with_upstream(upstream_url: impl Into<String>) -> Self
pub fn with_upstream(upstream_url: impl Into<String>) -> Self
Create a proxy provider with just an upstream URL.
Sourcepub fn with_validator_fn<F, Fut>(self, validator: F) -> Self
pub fn with_validator_fn<F, Fut>(self, validator: F) -> Self
Set a custom token validation function. This allows applications to implement custom validation logic.
Sourcepub fn with_validator(self, validator: Arc<dyn TokenValidator>) -> Self
pub fn with_validator(self, validator: Arc<dyn TokenValidator>) -> Self
Set a token validator implementation.
Sourcepub fn introspection_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn introspection_endpoint(self, endpoint: impl Into<String>) -> Self
Set the introspection endpoint.
Trait Implementations§
Source§impl AuthProvider for ProxyProvider
impl AuthProvider for ProxyProvider
Source§fn validate_request<'life0, 'life1, 'async_trait>(
&'life0 self,
authorization_header: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_request<'life0, 'life1, 'async_trait>(
&'life0 self,
authorization_header: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate an incoming request and extract authentication context. Read more
Source§fn auth_scheme(&self) -> &'static str
fn auth_scheme(&self) -> &'static str
Get the authentication scheme this provider uses (e.g., “Bearer”, “Basic”).
Source§fn is_required(&self) -> bool
fn is_required(&self) -> bool
Check if this provider requires authentication for all requests.
Source§impl Debug for ProxyProvider
impl Debug for ProxyProvider
Source§impl TokenValidator for ProxyProvider
impl TokenValidator for ProxyProvider
Source§fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate an access token and return token information.
Source§fn validate_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
token: &'life1 str,
required_scopes: Option<&'life2 [&'life3 str]>,
) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn validate_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
token: &'life1 str,
required_scopes: Option<&'life2 [&'life3 str]>,
) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Optionally validate token with additional context (e.g., required scopes).
Auto Trait Implementations§
impl !RefUnwindSafe for ProxyProvider
impl !UnwindSafe for ProxyProvider
impl Freeze for ProxyProvider
impl Send for ProxyProvider
impl Sync for ProxyProvider
impl Unpin for ProxyProvider
impl UnsafeUnpin for ProxyProvider
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