pub struct OAuthUserIdentityProvider { /* private fields */ }Expand description
An identity provider, backed by an OAuth server, that returns a user’s Biome ID
This provider uses an OAuthUserSessionStore as a cache of identities. The session store tracks all OAuth users’ sessions with a “last authenticated” timestamp. Sessions are initially added by the OAuth REST API endpoints when a user logs in.
If the session has not been authenticated within the re-authentication interval, the user will be re-authenticated using the internal OAuthClient and the session will be updated in the session store. If re-authentication fails, the session will be removed from the store and the user will need to start a new session by logging in.
This identity provider will also use a session’s refresh token (if it has one) to get a new OAuth access token for the session as needed.
This provider only accepts AuthorizationHeader::Bearer(BearerToken::OAuth2(token))
authorizations, and the inner token must be a valid Splinter access token for an OAuth user.
Implementations
sourceimpl OAuthUserIdentityProvider
impl OAuthUserIdentityProvider
sourcepub fn new(
oauth_client: OAuthClient,
oauth_user_session_store: Box<dyn OAuthUserSessionStore>,
reauthentication_interval: Option<Duration>
) -> Self
pub fn new(
oauth_client: OAuthClient,
oauth_user_session_store: Box<dyn OAuthUserSessionStore>,
reauthentication_interval: Option<Duration>
) -> Self
Creates a new OAuth user identity provider
Arguments
oauth_client- The OAuth client that will be used to check if a session is still validoauth_user_session_store- The store that tracks users’ sessionsreauthentication_interval- The amount of time since the last authentication for which the identity provider can assume the session is still valid. If this amount of time has elapsed since the last authentication of a session, the session will be re-authenticated by the identity provider. If not provided, the default will be used (1 hour).
Trait Implementations
sourceimpl Clone for OAuthUserIdentityProvider
impl Clone for OAuthUserIdentityProvider
sourcefn clone(&self) -> OAuthUserIdentityProvider
fn clone(&self) -> OAuthUserIdentityProvider
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl IdentityProvider for OAuthUserIdentityProvider
impl IdentityProvider for OAuthUserIdentityProvider
sourcefn get_identity(
&self,
authorization: &AuthorizationHeader
) -> Result<Option<Identity>, InternalError>
fn get_identity(
&self,
authorization: &AuthorizationHeader
) -> Result<Option<Identity>, InternalError>
Attempts to get the identity that corresponds to the given authorization header. This method
will return Ok(None) if the identity provider was not able to resolve the authorization
to an identity. Read more
sourcefn clone_box(&self) -> Box<dyn IdentityProvider>
fn clone_box(&self) -> Box<dyn IdentityProvider>
Clone implementation for IdentityProvider. The implementation of the Clone trait for
Box<dyn IdentityProvider> calls this method. Read more
Auto Trait Implementations
impl !RefUnwindSafe for OAuthUserIdentityProvider
impl Send for OAuthUserIdentityProvider
impl Sync for OAuthUserIdentityProvider
impl Unpin for OAuthUserIdentityProvider
impl !UnwindSafe for OAuthUserIdentityProvider
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
impl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
fn into_bytes(self) -> Result<Vec<u8, Global>, ProtoConversionError>
sourceimpl<N, P> IntoNative<N> for P where
N: FromProto<P>,
impl<N, P> IntoNative<N> for P where
N: FromProto<P>,
fn into_native(self) -> Result<N, ProtoConversionError>
sourceimpl<N, P> IntoProto<P> for N where
P: FromNative<N>,
impl<N, P> IntoProto<P> for N where
P: FromNative<N>,
fn into_proto(self) -> Result<P, ProtoConversionError>
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more