From 48a3dea059ba9ddb40ab052dc92e0f8540fd246a Mon Sep 17 00:00:00 2001 From: Guillaume Bouvignies Date: Wed, 13 Dec 2023 09:19:24 +0100 Subject: [PATCH] chore: Rename FF saml to enterprise_saml (#2844) --- .github/workflows/docker-image.yml | 2 +- backend/Cargo.toml | 2 +- backend/windmill-api/Cargo.toml | 2 +- backend/windmill-api/src/lib.rs | 6 +++--- backend/windmill-api/src/saml.rs | 32 +++++++++++++++--------------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index b834ac713a..f374d1e0f6 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -99,7 +99,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=enterprise,saml + features=enterprise,enterprise_saml nsjail=true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:latest diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 07a737bcb8..b788338686 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -35,7 +35,7 @@ incremental = true [features] enterprise = ["windmill-worker/enterprise", "windmill-queue/enterprise", "windmill-api/enterprise"] -saml = ["windmill-api/saml"] +enterprise_saml = ["windmill-api/enterprise_saml"] benchmark = ["windmill-api/benchmark", "windmill-worker/benchmark", "windmill-queue/benchmark"] flamegraph = ["windmill-common/flamegraph", "windmill-worker/flamegraph"] loki = ["windmill-common/loki"] diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index 9a0f8b5ca5..9f2a5432a6 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -10,7 +10,7 @@ path = "src/lib.rs" [features] enterprise = ["windmill-queue/enterprise", "async-stripe", "windmill-audit/enterprise"] -saml = ["samael"] +enterprise_saml = ["samael"] benchmark = [] [dependencies] diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index 25b03d1c49..b7e5e7e8f6 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -36,7 +36,7 @@ use tower_http::{ trace::TraceLayer, }; use windmill_common::db::UserDB; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use windmill_common::ee::{get_license_plan, LicensePlan}; use windmill_common::utils::rd_string; use windmill_common::worker::ALL_TAGS; @@ -160,13 +160,13 @@ pub async fn run_server( .allow_headers([http::header::CONTENT_TYPE, http::header::AUTHORIZATION]) .allow_origin(Any); - #[cfg(feature = "saml")] + #[cfg(feature = "enterprise_saml")] let sp_extension: (ServiceProviderExt, SamlSsoLogin) = match get_license_plan().await { LicensePlan::Enterprise => saml::build_sp_extension().await?, LicensePlan::Pro => (ServiceProviderExt(None), SamlSsoLogin(None)), }; - #[cfg(not(feature = "saml"))] + #[cfg(not(feature = "enterprise_saml"))] let sp_extension = (ServiceProviderExt(), SamlSsoLogin(None)); let embeddings_db = if server_mode { diff --git a/backend/windmill-api/src/saml.rs b/backend/windmill-api/src/saml.rs index 905ae35144..407ba8d781 100644 --- a/backend/windmill-api/src/saml.rs +++ b/backend/windmill-api/src/saml.rs @@ -7,45 +7,45 @@ */ #![allow(non_snake_case)] -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use axum::response::Redirect; use axum::{routing::post, Router}; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use axum::{Extension, Form}; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use std::sync::Arc; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use samael::metadata::{ContactPerson, ContactType, EntityDescriptor}; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use samael::service_provider::{ServiceProvider, ServiceProviderBuilder}; use serde::Deserialize; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use tower_cookies::Cookies; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use windmill_common::error::{Error, Result}; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use crate::db::DB; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use crate::users::login_externally; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use crate::BASE_URL; -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] #[derive(Clone)] pub struct ServiceProviderExt(pub Option); -#[cfg(not(feature = "saml"))] +#[cfg(not(feature = "enterprise_saml"))] pub struct ServiceProviderExt(); -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] use windmill_common::ee::{get_license_plan, LicensePlan}; pub struct SamlSsoLogin(pub Option); -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] pub async fn build_sp_extension() -> anyhow::Result<(ServiceProviderExt, SamlSsoLogin)> { if let Some(url_metadata) = std::env::var("SAML_METADATA").ok() { //todo restrict for non ee @@ -93,7 +93,7 @@ pub struct SamlForm { pub SAMLResponse: Option, } -#[cfg(feature = "saml")] +#[cfg(feature = "enterprise_saml")] pub async fn acs( Extension(db): Extension, cookies: Cookies, @@ -129,7 +129,7 @@ pub async fn acs( } } -#[cfg(not(feature = "saml"))] +#[cfg(not(feature = "enterprise_saml"))] pub async fn acs() -> String { "SAML available only in enterprise version".to_string() }