From 7e48ab72210ce4da93682da691b7dc6cf44b2d32 Mon Sep 17 00:00:00 2001 From: Shrey Bana Date: Wed, 4 Dec 2024 15:10:32 +0530 Subject: [PATCH] feat: Added hostname as an env. --- crates/superposition/src/auth/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/superposition/src/auth/mod.rs b/crates/superposition/src/auth/mod.rs index 24ac381f..779b4c24 100644 --- a/crates/superposition/src/auth/mod.rs +++ b/crates/superposition/src/auth/mod.rs @@ -20,6 +20,9 @@ pub fn init_auth() -> saml2::SAMLAuthProvider { .unwrap(); let md_xml = fs::read_to_string("saml-idp-meta.xml").unwrap(); let md: EntityDescriptor = samael::metadata::de::from_str(md_xml.as_str()).unwrap(); + let host = env::var("HOSTNAME") + .ok() + .expect("Env 'HOSTNAME' not declared."); let sp = ServiceProviderBuilder::default() .entity_id("test-saml-sso-app".to_string()) .idp_metadata(md) @@ -29,8 +32,8 @@ pub fn init_auth() -> saml2::SAMLAuthProvider { sur_name: Some("Doe".to_string()), ..ContactPerson::default() }) - .acs_url("https://test.devspaceworks.net/saml/acs".to_string()) - .slo_url("/saml/slo".to_string()) + .acs_url(format!("https://{}/saml/acs", host)) + .slo_url(format!("https://{}/saml/metadata", host)) .build() .unwrap(); saml2::SAMLAuthProvider {