Skip to main content

AirLibrary/Client/AirServiceProvider/
Authenticate.rs

1//! `AirServiceProvider::Authenticate` - authenticate a user with the Air
2//! daemon. Mints a request id, forwards to
3//! [`crate::Client::AirClient::AirClient::Authenticate`], and surfaces
4//! the returned session token.
5
6use crate::{AirError, Client::AirServiceProvider::AirServiceProvider, dev_log};
7
8impl AirServiceProvider {
9	/// Authenticates a user against the named provider (`"github"`,
10	/// `"gitlab"`, `"microsoft"`, …) and returns the session token on
11	/// success.
12	pub async fn Authenticate(&self, username:String, password:String, provider:String) -> Result<String, AirError> {
13		let RequestID = crate::Utility::GenerateRequestId();
14
15		dev_log!("grpc", "[AirServiceProvider] Authenticate (request_id: {})", RequestID);
16
17		self.client.Authenticate(RequestID, username, password, provider).await
18	}
19}