pub struct AuthClient { /* private fields */ }Expand description
A client that handles CouchDB authentication.
Uses cookie-based auth (_session endpoint). The internal reqwest::Client
has a cookie store enabled, so after login() all subsequent requests
automatically include the auth cookie.
Implementations§
Source§impl AuthClient
impl AuthClient
Sourcepub fn new(server_url: &str) -> Self
pub fn new(server_url: &str) -> Self
Create a new auth client for the given CouchDB server URL.
Sourcepub fn server_url(&self) -> &str
pub fn server_url(&self) -> &str
Get the server URL.
Sourcepub async fn login(&self, username: &str, password: &str) -> Result<Session>
pub async fn login(&self, username: &str, password: &str) -> Result<Session>
Log in with username and password (cookie-based auth).
Sourcepub async fn get_session(&self) -> Result<Session>
pub async fn get_session(&self) -> Result<Session>
Get the current session.
Auto Trait Implementations§
impl Freeze for AuthClient
impl !RefUnwindSafe for AuthClient
impl Send for AuthClient
impl Sync for AuthClient
impl Unpin for AuthClient
impl !UnwindSafe for AuthClient
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