pub struct ClientSessionData<S: BosStr = DefaultStr> {
pub account_did: Did<S>,
pub session_id: S,
pub host_url: Uri<String>,
pub authserver_url: S,
pub authserver_token_endpoint: S,
pub authserver_revocation_endpoint: Option<S>,
pub scopes: Scopes<S>,
pub dpop_data: DpopClientData,
pub token_set: TokenSet<S>,
pub resolved_scopes: Option<Vec<Scope<SmolStr>>>,
}Expand description
Persisted information about an OAuth session. Used to resume an active session.
Fields§
§account_did: Did<S>DID of the authenticated account; serves as the primary key for session storage because only one active session per account is assumed.
session_id: SOpaque identifier that distinguishes this session from other sessions for the same account.
Reuses the random state token generated during the PAR flow.
host_url: Uri<String>Base URL of the resource server (PDS): scheme, host, and port only
authserver_url: SBase URL of the authorization server (PDS or entryway): scheme, host, and port only
authserver_token_endpoint: SFull URL of the authorization server’s token endpoint.
authserver_revocation_endpoint: Option<S>Full URL of the authorization server’s revocation endpoint, if advertised.
scopes: Scopes<S>The set of OAuth scopes approved for this session, as returned in the initial token response.
dpop_data: DpopClientDataDPoP key and nonce state for ongoing requests in this session.
token_set: TokenSet<S>Current token set (access token, refresh token, expiry, etc.).
resolved_scopes: Option<Vec<Scope<SmolStr>>>Fully expanded scopes with include scopes resolved.
This is populated eagerly at session creation when scope-check is enabled.
It is None when scope checking is not enabled, when no eager resolution was
performed, or when reading older persisted sessions that predate this field.
Implementations§
Source§impl<S: BosStr + Ord + AsRef<str>> ClientSessionData<S>
impl<S: BosStr + Ord + AsRef<str>> ClientSessionData<S>
Sourcepub fn update_with_tokens(&mut self, token_set: &TokenSet<S>)
pub fn update_with_tokens(&mut self, token_set: &TokenSet<S>)
Update this session’s token set and, if the new token set includes scopes, replace the scope list.
Called after a successful token refresh so that any scope changes returned by the server are reflected in the persisted session without requiring a full re-authentication.
This method is only available on DefaultStr-backed sessions (the common case for
in-memory sessions). Zero-copy borrowed sessions are read-only by nature and would
not be refreshed in place.
Trait Implementations§
Source§impl<S: Clone + BosStr> Clone for ClientSessionData<S>
impl<S: Clone + BosStr> Clone for ClientSessionData<S>
Source§fn clone(&self) -> ClientSessionData<S>
fn clone(&self) -> ClientSessionData<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, S> Deserialize<'de> for ClientSessionData<S>
impl<'de, S> Deserialize<'de> for ClientSessionData<S>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<S: Eq + BosStr> Eq for ClientSessionData<S>
Source§impl<S: BosStr + Ord + IntoStatic + AsRef<str>> IntoStatic for ClientSessionData<S>
impl<S: BosStr + Ord + IntoStatic + AsRef<str>> IntoStatic for ClientSessionData<S>
Source§type Output = ClientSessionData<<S as IntoStatic>::Output>
type Output = ClientSessionData<<S as IntoStatic>::Output>
Cow<'a, str>, this is Cow<'static, str>, for example.Source§fn into_static(self) -> Self::Output
fn into_static(self) -> Self::Output
Source§impl<S> Serialize for ClientSessionData<S>
impl<S> Serialize for ClientSessionData<S>
Source§impl<T: ClientAuthStore + Send + Sync> SessionStore<SessionKey, ClientSessionData> for Arc<T>
impl<T: ClientAuthStore + Send + Sync> SessionStore<SessionKey, ClientSessionData> for Arc<T>
Source§async fn get(&self, key: &SessionKey) -> Option<ClientSessionData>
async fn get(&self, key: &SessionKey) -> Option<ClientSessionData>
Get the current session if present.
Source§async fn set(
&self,
_key: SessionKey,
session: ClientSessionData,
) -> Result<(), SessionStoreError>
async fn set( &self, _key: SessionKey, session: ClientSessionData, ) -> Result<(), SessionStoreError>
Persist the given session.
Source§async fn del(&self, key: &SessionKey) -> Result<(), SessionStoreError>
async fn del(&self, key: &SessionKey) -> Result<(), SessionStoreError>
Delete the given session.
Source§async fn list_keys(&self) -> Result<Vec<SessionKey>, SessionStoreError>
async fn list_keys(&self) -> Result<Vec<SessionKey>, SessionStoreError>
impl<S: PartialEq + BosStr> StructuralPartialEq for ClientSessionData<S>
Auto Trait Implementations§
impl<S> Freeze for ClientSessionData<S>
impl<S> RefUnwindSafe for ClientSessionData<S>where
Did<S>: RefUnwindSafe,
S: RefUnwindSafe,
Option<S>: RefUnwindSafe,
Scopes<S>: RefUnwindSafe,
TokenSet<S>: RefUnwindSafe,
impl<S> Send for ClientSessionData<S>
impl<S> Sync for ClientSessionData<S>
impl<S> Unpin for ClientSessionData<S>
impl<S> UnsafeUnpin for ClientSessionData<S>where
Did<S>: UnsafeUnpin,
S: UnsafeUnpin,
Option<S>: UnsafeUnpin,
Scopes<S>: UnsafeUnpin,
TokenSet<S>: UnsafeUnpin,
impl<S> UnwindSafe for ClientSessionData<S>where
Did<S>: UnwindSafe,
S: UnwindSafe,
Option<S>: UnwindSafe,
Scopes<S>: UnwindSafe,
TokenSet<S>: UnwindSafe,
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.