Skip to main content

AuthenticationFlow

Trait AuthenticationFlow 

Source
pub trait AuthenticationFlow: Send + Sync {
    type State: Send + Sync;

    // Required methods
    fn available_methods(&self) -> Vec<AuthMethod>;
    fn start_auth<'life0, 'async_trait>(
        &'life0 self,
        method: AuthMethod,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_initial_progress<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 Self::State,
        method: AuthMethod,
    ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn handle_input<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        state: &'life1 mut Self::State,
        input: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn is_authenticated<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn provider_name(&self) -> String;
}
Expand description

Generic authentication flow trait that providers can implement

Required Associated Types§

Source

type State: Send + Sync

The state type for this authentication flow

Required Methods§

Source

fn available_methods(&self) -> Vec<AuthMethod>

Get available authentication methods for this provider

Source

fn start_auth<'life0, 'async_trait>( &'life0 self, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<Self::State, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Start an authentication flow

Source

fn get_initial_progress<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 Self::State, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get initial progress/instructions after starting auth

Source

fn handle_input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 mut Self::State, input: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Handle user input during authentication

Source

fn is_authenticated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Check if the provider is already authenticated

Source

fn provider_name(&self) -> String

Get a display name for the provider

Implementations on Foreign Types§

Source§

impl AuthenticationFlow for AnthropicOAuthFlow

Source§

type State = AnthropicAuthState

Source§

fn available_methods(&self) -> Vec<AuthMethod>

Source§

fn start_auth<'life0, 'async_trait>( &'life0 self, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<<AnthropicOAuthFlow as AuthenticationFlow>::State, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, AnthropicOAuthFlow: 'async_trait,

Source§

fn get_initial_progress<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 <AnthropicOAuthFlow as AuthenticationFlow>::State, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, AnthropicOAuthFlow: 'async_trait,

Source§

fn handle_input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 mut <AnthropicOAuthFlow as AuthenticationFlow>::State, input: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, AnthropicOAuthFlow: 'async_trait,

Source§

fn is_authenticated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, AnthropicOAuthFlow: 'async_trait,

Source§

fn provider_name(&self) -> String

Source§

impl AuthenticationFlow for OpenAIOAuthFlow

Source§

type State = OpenAIAuthState

Source§

fn available_methods(&self) -> Vec<AuthMethod>

Source§

fn start_auth<'life0, 'async_trait>( &'life0 self, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<<OpenAIOAuthFlow as AuthenticationFlow>::State, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpenAIOAuthFlow: 'async_trait,

Source§

fn get_initial_progress<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 <OpenAIOAuthFlow as AuthenticationFlow>::State, method: AuthMethod, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, OpenAIOAuthFlow: 'async_trait,

Source§

fn handle_input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 mut <OpenAIOAuthFlow as AuthenticationFlow>::State, input: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AuthProgress, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, OpenAIOAuthFlow: 'async_trait,

Source§

fn is_authenticated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpenAIOAuthFlow: 'async_trait,

Source§

fn provider_name(&self) -> String

Implementors§