Struct dittolive_ditto::auth::DittoAuthenticator
source · [−]pub struct DittoAuthenticator { /* private fields */ }
Expand description
Handle to trigger actual authentication requests
Implementations
sourceimpl DittoAuthenticator
impl DittoAuthenticator
pub fn new(auth_client: Arc<BoxedAuthClient>) -> Self
sourcepub fn login_with_token(
&self,
token: &str,
provider: &str
) -> Result<(), DittoError>
👎 Deprecated
pub fn login_with_token(
&self,
token: &str,
provider: &str
) -> Result<(), DittoError>
Asks the Ditto AuthClient to make an Auth Request to the configured Identity’s auth url with a single token parameter.
token
- An auth or API token you have configuredprovider
- The name of an authentication provider web hook you have configured in Ditto Cloud, which will accept thetoken
and contact your Auth service
sourcepub fn login_with_token_and_feedback(
&self,
token: &str,
provider: &str
) -> Result<AuthenticationClientFeedback, DittoError>
pub fn login_with_token_and_feedback(
&self,
token: &str,
provider: &str
) -> Result<AuthenticationClientFeedback, DittoError>
Asks the Ditto AuthClient to make an Auth Request to the configured Identity’s auth url with a single token paramater.
token
- An auth or API token you have configured.provider
- The name of an authentication provider web hook you have configured in Ditto Cloud, which will accept thetoken
and contact your Auth service
pub fn login_with_credentials(
&self,
username: &str,
password: &str,
provider: &str
) -> Result<(), DittoError>
sourcepub fn logout<R>(
&self,
cleanup: impl FnOnce(Ditto) -> R
) -> Result<R, DittoError>
pub fn logout<R>(
&self,
cleanup: impl FnOnce(Ditto) -> R
) -> Result<R, DittoError>
Log out of Ditto Shutdown all replication sessions and remove any cached authentication credentials. This does not remove the local data store.
sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Query whether Ditto has a valid authentication token.
This will only be true
when using an Online
or an
OnlineWithAuthentication
identity, after a successful login. If the
authentication token is allowed to expire then it will return false
instead.
Trait Implementations
sourceimpl Clone for DittoAuthenticator
impl Clone for DittoAuthenticator
sourcefn clone(&self) -> DittoAuthenticator
fn clone(&self) -> DittoAuthenticator
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
Auto Trait Implementations
impl !RefUnwindSafe for DittoAuthenticator
impl Send for DittoAuthenticator
impl Sync for DittoAuthenticator
impl Unpin for DittoAuthenticator
impl !UnwindSafe for DittoAuthenticator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ManuallyDropMut for T
impl<T> ManuallyDropMut for T
type Ret = ManuallyDrop<T>
pub fn manually_drop_mut(&'__ mut self) -> &'__ mut ManuallyDrop<T>
impl<T> To for T where
T: ?Sized,
impl<T> To for T where
T: ?Sized,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more