pub struct Client { /* private fields */ }Expand description
Storage-free Project Auth Runtime client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self, OwlAuthError>
pub fn new(config: ClientConfig) -> Result<Self, OwlAuthError>
Construct a client using the built-in HTTP transport.
§Errors
Returns an error for invalid configuration or HTTP transport setup failure.
Sourcepub fn with_transport(
config: ClientConfig,
transport: Arc<dyn Transport>,
) -> Result<Self, OwlAuthError>
pub fn with_transport( config: ClientConfig, transport: Arc<dyn Transport>, ) -> Result<Self, OwlAuthError>
Construct a client with an application-supplied transport.
§Errors
Returns an error for invalid configuration.
Sourcepub async fn get_config(&self) -> Result<PublicApplicationConfig, OwlAuthError>
pub async fn get_config(&self) -> Result<PublicApplicationConfig, OwlAuthError>
Fetch the public configuration for the configured Application.
§Errors
Returns a Runtime, transport, or response validation error.
Sourcepub async fn get_jwks(&self) -> Result<JwksDocument, OwlAuthError>
pub async fn get_jwks(&self) -> Result<JwksDocument, OwlAuthError>
Fetch the configured Project’s public signing keys.
§Errors
Returns a Runtime, transport, or response validation error.
Sourcepub async fn start_login(
&self,
redirect_uri: &str,
) -> Result<PendingLogin, OwlAuthError>
pub async fn start_login( &self, redirect_uri: &str, ) -> Result<PendingLogin, OwlAuthError>
Generate fresh PKCE and state and start one hosted login.
§Errors
Returns an error if the redirect URI is invalid, secure entropy is unavailable, or Runtime fails.
Sourcepub async fn exchange_handoff(
&self,
handoff_code: &str,
pkce_verifier: &str,
) -> Result<SessionTokens, OwlAuthError>
pub async fn exchange_handoff( &self, handoff_code: &str, pkce_verifier: &str, ) -> Result<SessionTokens, OwlAuthError>
Exchange an already validated handoff code with its original verifier.
§Errors
Returns a Runtime, transport, or response validation error.
Sourcepub async fn complete_login(
&self,
callback: &str,
pending: &PendingLogin,
) -> Result<SessionTokens, OwlAuthError>
pub async fn complete_login( &self, callback: &str, pending: &PendingLogin, ) -> Result<SessionTokens, OwlAuthError>
Validate the callback against the pending login before exchanging the handoff.
§Errors
Returns callback validation, Runtime, transport, or response validation errors.
Sourcepub async fn refresh(
&self,
refresh_token: &str,
) -> Result<SessionTokens, OwlAuthError>
pub async fn refresh( &self, refresh_token: &str, ) -> Result<SessionTokens, OwlAuthError>
Sourcepub async fn current_user(
&self,
access_token: &str,
) -> Result<CurrentUser, OwlAuthError>
pub async fn current_user( &self, access_token: &str, ) -> Result<CurrentUser, OwlAuthError>
Fetch the user projected into this Application.
§Errors
Returns a Runtime, transport, or response validation error.
Sourcepub async fn prepare_browser_logout(
&self,
access_token: &str,
redirect_uri: &str,
) -> Result<HostedNavigation, OwlAuthError>
pub async fn prepare_browser_logout( &self, access_token: &str, redirect_uri: &str, ) -> Result<HostedNavigation, OwlAuthError>
Prepare hosted browser logout. The caller navigates to the URL returned.
§Errors
Returns redirect URI validation, Runtime, transport, or response validation errors.