diff --git a/crates/nefarious-login/src/auth.rs b/crates/nefarious-login/src/auth.rs index b8678bb..58cb787 100644 --- a/crates/nefarious-login/src/auth.rs +++ b/crates/nefarious-login/src/auth.rs @@ -24,10 +24,11 @@ pub trait Auth { pub struct AuthService(Arc); impl AuthService { - pub async fn new(config: &AuthClap, session: SessionService) -> anyhow::Result { + pub async fn new(config: &AuthClap) -> anyhow::Result { match config.engine { AuthEngine::Noop => Ok(Self::new_noop()), AuthEngine::Zitadel => { + let session = SessionService::new(config).await?; let oauth: OAuth = ZitadelConfig::try_from(config.zitadel.clone())?.into(); let introspection: IntrospectionService = IntrospectionService::new_zitadel(config).await?; diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs index ad6f86d..433d151 100644 --- a/examples/basic/src/main.rs +++ b/examples/basic/src/main.rs @@ -48,11 +48,7 @@ async fn main() -> anyhow::Result<()> { }, }; - let auth_service = AuthService::new_zitadel( - OAuth::try_from(auth.clone())?, - IntrospectionService::new_zitadel(&auth).await?, - SessionService::new(&auth).await?, - ); + let auth_service = AuthService::new(&auth); let state = AppState { auth: auth_service.clone(), diff --git a/examples/clap/src/main.rs b/examples/clap/src/main.rs index 1ed2a2f..60414a4 100644 --- a/examples/clap/src/main.rs +++ b/examples/clap/src/main.rs @@ -43,10 +43,7 @@ async fn main() -> anyhow::Result<()> { "--session-postgres-conn=postgres://como:somenotverysecurepassword@localhost:5432/como", ]); - let auth = cmd.auth; - - let session_service = SessionService::new(&auth).await?; - let auth_service = AuthService::new(&auth, session_service).await?; + let auth_service = AuthService::new(&cmd.auth).await?; let state = AppState { auth: auth_service.clone(),