steer_core/auth/
registry.rs1use crate::api::ProviderKind;
2use crate::auth::{AuthFlowWrapper, AuthStorage, DynAuthenticationFlow};
3use std::sync::Arc;
4
5pub struct ProviderRegistry;
7
8impl ProviderRegistry {
9 pub fn create_auth_flow(
10 provider: ProviderKind,
11 storage: Arc<dyn AuthStorage>,
12 ) -> Option<Box<dyn DynAuthenticationFlow>> {
13 match provider {
14 ProviderKind::Anthropic => {
15 use crate::auth::anthropic::AnthropicOAuthFlow;
16 Some(Box::new(AuthFlowWrapper::new(AnthropicOAuthFlow::new(
17 storage,
18 ))))
19 }
20 ProviderKind::OpenAI | ProviderKind::Google | ProviderKind::XAI => {
21 use crate::auth::api_key::ApiKeyAuthFlow;
22 Some(Box::new(AuthFlowWrapper::new(ApiKeyAuthFlow::new(
23 storage, provider,
24 ))))
25 }
26 }
27 }
28}