From c46bd34e168728875df040a8208326fd7420e565 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Wed, 1 Nov 2023 21:57:33 +0100 Subject: [PATCH] feat: with actual return url Signed-off-by: kjuulh --- crates/nefarious-login/src/auth.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/nefarious-login/src/auth.rs b/crates/nefarious-login/src/auth.rs index aa613ec..024980b 100644 --- a/crates/nefarious-login/src/auth.rs +++ b/crates/nefarious-login/src/auth.rs @@ -7,7 +7,7 @@ use oauth2::url::Url; use crate::{ introspection::IntrospectionService, - login::{auth_clap::AuthEngine, AuthClap}, + login::{auth_clap::AuthEngine, config::ConfigClap, AuthClap}, oauth::{zitadel::ZitadelConfig, OAuth}, session::{SessionService, User}, }; @@ -32,8 +32,12 @@ impl AuthService { let oauth: OAuth = ZitadelConfig::try_from(config.zitadel.clone())?.into(); let introspection: IntrospectionService = IntrospectionService::new_zitadel(config).await?; - - Ok(Self::new_zitadel(oauth, introspection, session)) + Ok(Self::new_zitadel( + oauth, + introspection, + session, + &config.config, + )) } } } @@ -42,11 +46,13 @@ impl AuthService { oauth: OAuth, introspection: IntrospectionService, session: SessionService, + config: &ConfigClap, ) -> Self { Self(Arc::new(ZitadelAuthService { oauth, introspection, session, + config: config.clone(), })) } @@ -67,6 +73,7 @@ pub struct ZitadelAuthService { oauth: OAuth, introspection: IntrospectionService, session: SessionService, + config: ConfigClap, } pub static COOKIE_NAME: &str = "SESSION"; @@ -89,7 +96,7 @@ impl Auth for ZitadelAuthService { Ok(( headers, - Url::parse("http://localhost:3001/authed") + Url::parse(&self.config.return_url) .context("failed to parse login_authorized zitadel return url")?, )) }