pub struct AuthProxyState { /* private fields */ }Expand description
Shared state of the proxy: the token registry, the configuration and the upstream HTTP client. Cheap to clone.
§Examples
use ironflow_auth_proxy::{AuthProxyConfig, AuthProxyState};
let state = AuthProxyState::new(AuthProxyConfig::new("0123456789abcdef0123456789abcdef"))?;
assert!(state.registry().is_empty().await?);Implementations§
Source§impl AuthProxyState
impl AuthProxyState
Sourcepub fn new(config: AuthProxyConfig) -> Result<Self, ReqwestError>
pub fn new(config: AuthProxyConfig) -> Result<Self, ReqwestError>
Build the state with an empty in-memory registry.
§Errors
Returns the reqwest::Error raised when the HTTP client cannot be
built (TLS backend initialisation).
§Examples
See AuthProxyState.
Sourcepub fn with_registry(
config: AuthProxyConfig,
registry: AuthProxyRegistry,
) -> Result<Self, ReqwestError>
pub fn with_registry( config: AuthProxyConfig, registry: AuthProxyRegistry, ) -> Result<Self, ReqwestError>
Build the state over registry, for instance the shared PostgreSQL
registry returned by registry_from_config. Proxies built over
registries sharing a backend serve the same tokens.
The upstream client never follows redirects and only bounds the connection time.
§Errors
Returns the reqwest::Error raised when the HTTP client cannot be
built (TLS backend initialisation).
§Examples
use ironflow_auth_proxy::{AuthProxyConfig, AuthProxyState};
use ironflow_core::auth_proxy::AuthProxyRegistry;
let registry = AuthProxyRegistry::default();
let config = AuthProxyConfig::new("0123456789abcdef0123456789abcdef");
let a = AuthProxyState::with_registry(config.clone(), registry.clone())?;
let b = AuthProxyState::with_registry(config, registry)?;Sourcepub fn registry(&self) -> &AuthProxyRegistry
pub fn registry(&self) -> &AuthProxyRegistry
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AuthProxyState
impl !UnwindSafe for AuthProxyState
impl Freeze for AuthProxyState
impl Send for AuthProxyState
impl Sync for AuthProxyState
impl Unpin for AuthProxyState
impl UnsafeUnpin for AuthProxyState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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