pub struct OAuth2Registry { /* private fields */ }Expand description
In-memory registry, keyed by (tenant_id, provider_name). Arc-wrapped
internally so cheap to clone and pass into axum state.
Implementations§
Source§impl OAuth2Registry
impl OAuth2Registry
pub fn new() -> Self
Sourcepub fn register(&self, tenant: impl Into<String>, provider: OAuth2Provider)
pub fn register(&self, tenant: impl Into<String>, provider: OAuth2Provider)
Register provider under (tenant, provider.name).
Sourcepub fn deregister(&self, tenant: &str, name: &str) -> bool
pub fn deregister(&self, tenant: &str, name: &str) -> bool
Drop a provider. Returns true if something was removed.
Sourcepub fn get(&self, tenant: &str, name: &str) -> Option<Arc<OAuth2Provider>>
pub fn get(&self, tenant: &str, name: &str) -> Option<Arc<OAuth2Provider>>
Look up the provider for (tenant, name). Returns None when
either the tenant or the provider isn’t configured.
Sourcepub fn list(&self) -> Vec<(String, String)>
pub fn list(&self) -> Vec<(String, String)>
Return all (tenant, provider_name) pairs currently registered.
Sourcepub fn list_for_tenant(&self, tenant: &str) -> Vec<String>
pub fn list_for_tenant(&self, tenant: &str) -> Vec<String>
Return the configured provider names for a tenant.
Trait Implementations§
Source§impl Clone for OAuth2Registry
impl Clone for OAuth2Registry
Source§fn clone(&self) -> OAuth2Registry
fn clone(&self) -> OAuth2Registry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for OAuth2Registry
impl Default for OAuth2Registry
Source§fn default() -> OAuth2Registry
fn default() -> OAuth2Registry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OAuth2Registry
impl RefUnwindSafe for OAuth2Registry
impl Send for OAuth2Registry
impl Sync for OAuth2Registry
impl Unpin for OAuth2Registry
impl UnsafeUnpin for OAuth2Registry
impl UnwindSafe for OAuth2Registry
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