Struct mz_frontegg_auth::auth::AuthenticatorInner
source · struct AuthenticatorInner {
admin_api_token_url: String,
client: Client,
validation: Validation,
decoding_key: DecodingKey,
tenant_id: Option<Uuid>,
admin_role: String,
now: NowFn,
active_sessions: Mutex<BTreeMap<AppPassword, AuthSession>>,
dropped_sessions: Mutex<LruCache<AppPassword, Instant>>,
refresh_drop_factor: f64,
metrics: Metrics,
}
Fields§
§admin_api_token_url: String
Frontegg API fields.
client: Client
§validation: Validation
JWT decoding and validation fields.
decoding_key: DecodingKey
§tenant_id: Option<Uuid>
§admin_role: String
§now: NowFn
§active_sessions: Mutex<BTreeMap<AppPassword, AuthSession>>
Session tracking.
dropped_sessions: Mutex<LruCache<AppPassword, Instant>>
Most recent time at which a session created with an AppPassword
was dropped.
We track when a session was dropped to handle the case of many one-shot queries being
issued in rapid succession. If it comes time to refresh an auth token, and there are no
currently alive sessions, but one was recently dropped, we’ll pre-emptively refresh to get
ahead of another session being created with the same AppPassword
.
refresh_drop_factor: f64
How large of a window we’ll use for determining if a session was dropped “recently”, and if we should refresh the session, even if there are not any active handles to it.
metrics: Metrics
Metrics.
Implementations§
source§impl AuthenticatorInner
impl AuthenticatorInner
async fn authenticate( self: &Arc<Self>, expected_user: String, password: AppPassword, ) -> Result<AuthSessionHandle, Error>
async fn exchange_app_password( &self, expected_user: &str, password: AppPassword, ) -> Result<ValidatedClaims, Error>
fn validate_access_token( &self, token: &str, expected_user: Option<&str>, ) -> Result<ValidatedClaims, Error>
sourcefn record_dropped_session(&self, app_password: AppPassword)
fn record_dropped_session(&self, app_password: AppPassword)
Records an AuthSessionHandle
that was recently dropped.
sourcefn last_dropped_session(&self, app_password: &AppPassword) -> Option<Instant>
fn last_dropped_session(&self, app_password: &AppPassword) -> Option<Instant>
Returns the instant that an AuthSessionHandle
created with the provided AppPassword
was last dropped.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthenticatorInner
impl !RefUnwindSafe for AuthenticatorInner
impl Send for AuthenticatorInner
impl Sync for AuthenticatorInner
impl Unpin for AuthenticatorInner
impl !UnwindSafe for AuthenticatorInner
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.