@@ -88,7 +88,7 @@ impl Auth for ZitadelAuthService {
|
||||
|
||||
Ok((
|
||||
headers,
|
||||
Url::parse("http://localhost:3000/dash/home")
|
||||
Url::parse("http://localhost:3001/authed")
|
||||
.context("failed to parse login_authorized zitadel return url")?,
|
||||
))
|
||||
}
|
||||
|
@@ -50,11 +50,8 @@ pub mod config {
|
||||
}
|
||||
|
||||
#[derive(clap::Args, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[group(requires_all = ["auth_url", "client_id", "client_secret", "redirect_url", "token_url", "authority_url"])]
|
||||
#[group(requires_all = ["client_id", "client_secret", "redirect_url", "authority_url"])]
|
||||
pub struct ZitadelClap {
|
||||
#[arg(env = "ZITADEL_AUTH_URL", long = "zitadel-auth-url")]
|
||||
pub auth_url: Option<String>,
|
||||
|
||||
#[arg(env = "ZITADEL_CLIENT_ID", long = "zitadel-client-id")]
|
||||
pub client_id: Option<String>,
|
||||
|
||||
@@ -66,9 +63,6 @@ pub mod config {
|
||||
|
||||
#[arg(env = "ZITADEL_AUTHORITY_URL", long = "zitadel-authority-url")]
|
||||
pub authority_url: Option<String>,
|
||||
|
||||
#[arg(env = "ZITADEL_TOKEN_URL", long = "zitadel-token-url")]
|
||||
pub token_url: Option<String>,
|
||||
}
|
||||
|
||||
impl TryFrom<AuthClap> for OAuth {
|
||||
@@ -85,11 +79,6 @@ pub mod config {
|
||||
impl AuthClap {
|
||||
pub fn merge(&mut self, config: AuthConfigFile) -> &mut Self {
|
||||
if let Some(zitadel) = config.zitadel {
|
||||
if let Some(auth_url) = zitadel.auth_url {
|
||||
if self.zitadel.auth_url.is_some() {
|
||||
_ = self.zitadel.auth_url.replace(auth_url);
|
||||
}
|
||||
}
|
||||
if let Some(client_id) = zitadel.client_id {
|
||||
if self.zitadel.client_id.is_some() {
|
||||
_ = self.zitadel.client_id.replace(client_id);
|
||||
@@ -110,11 +99,6 @@ pub mod config {
|
||||
_ = self.zitadel.authority_url.replace(authority_url);
|
||||
}
|
||||
}
|
||||
if let Some(token_url) = zitadel.token_url {
|
||||
if self.zitadel.token_url.is_some() {
|
||||
_ = self.zitadel.token_url.replace(token_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self
|
||||
|
@@ -78,10 +78,14 @@ impl TryFrom<ZitadelClap> for ZitadelConfig {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
fn try_from(value: ZitadelClap) -> Result<Self, Self::Error> {
|
||||
let authority_url = value
|
||||
.authority_url
|
||||
.ok_or(anyhow::anyhow!("authority_url was not set"))?;
|
||||
|
||||
Ok(Self {
|
||||
auth_url: value
|
||||
.auth_url
|
||||
.ok_or(anyhow::anyhow!("auth_url was not set"))?,
|
||||
auth_url: format!("{}/oauth/v2/authorize", &authority_url),
|
||||
token_url: format!("{}/oauth/v2/token", &authority_url),
|
||||
authority_url,
|
||||
client_id: value
|
||||
.client_id
|
||||
.ok_or(anyhow::anyhow!("client_id was not set"))?,
|
||||
@@ -91,12 +95,6 @@ impl TryFrom<ZitadelClap> for ZitadelConfig {
|
||||
redirect_url: value
|
||||
.redirect_url
|
||||
.ok_or(anyhow::anyhow!("redirect_url was not set"))?,
|
||||
token_url: value
|
||||
.token_url
|
||||
.ok_or(anyhow::anyhow!("token_url was not set"))?,
|
||||
authority_url: value
|
||||
.authority_url
|
||||
.ok_or(anyhow::anyhow!("authority_url was not set"))?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user