pub struct SessionSignIn { /* private fields */ }Expand description
A sign-in held for this session only, until setup or bootstrap publishes it to device custody: with the store, or for a join once it saves its invite code. It then refreshes there (§13.2, §20.2).
Implementations§
Source§impl SessionSignIn
impl SessionSignIn
Sourcepub fn new(tokens: OAuthTokens, oauth: Option<OAuthExchange>) -> Arc<Self> ⓘ
pub fn new(tokens: OAuthTokens, oauth: Option<OAuthExchange>) -> Arc<Self> ⓘ
Hold tokens from a completed sign-in.
Sourcepub fn provider(&self) -> CloudProvider
pub fn provider(&self) -> CloudProvider
The provider this sign-in is for.
Sourcepub fn tokens(&self) -> Result<OAuthTokens, SyncError>
pub fn tokens(&self) -> Result<OAuthTokens, SyncError>
The tokens a new connection starts with.
Sourcepub fn publish<T>(
&self,
device: &Arc<DeviceCredentials>,
commit: impl FnOnce(&CredentialKeychains, &OAuthTokens) -> Result<T, SyncError>,
) -> Result<T, SyncError>
pub fn publish<T>( &self, device: &Arc<DeviceCredentials>, commit: impl FnOnce(&CredentialKeychains, &OAuthTokens) -> Result<T, SyncError>, ) -> Result<T, SyncError>
Commit the held tokens to device custody with commit, after which
rejections refresh there. Returns commit’s result; nothing moves if it fails.
Trait Implementations§
Source§impl TokenCustody for SessionSignIn
impl TokenCustody for SessionSignIn
Source§fn replace<'life0, 'life1, 'async_trait>(
&'life0 self,
rejected: &'life1 OAuthTokens,
) -> Pin<Box<dyn Future<Output = Result<OAuthTokens, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace<'life0, 'life1, 'async_trait>(
&'life0 self,
rejected: &'life1 OAuthTokens,
) -> Pin<Box<dyn Future<Output = Result<OAuthTokens, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replace tokens the provider rejected with HTTP 401. When the held
sign-in no longer is
rejected (another connection refreshed it, or a
new sign-in was committed), return the held one; otherwise refresh once
and commit the replacement here before returning it. A failed refresh
or commit returns its error and installs nothing.Auto Trait Implementations§
impl !Freeze for SessionSignIn
impl !RefUnwindSafe for SessionSignIn
impl !UnwindSafe for SessionSignIn
impl Send for SessionSignIn
impl Sync for SessionSignIn
impl Unpin for SessionSignIn
impl UnsafeUnpin for SessionSignIn
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreCreates a shared type from an unshared type.