chore: Rename FF saml to enterprise_saml (#2844)

This commit is contained in:
Guillaume Bouvignies
2023-12-13 09:19:24 +01:00
committed by GitHub
parent 372aa3e639
commit 48a3dea059
5 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"]
+1 -1
View File
@@ -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]
+3 -3
View File
@@ -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 {
+16 -16
View File
@@ -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<ServiceProvider>);
#[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<String>);
#[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<String>,
}
#[cfg(feature = "saml")]
#[cfg(feature = "enterprise_saml")]
pub async fn acs(
Extension(db): Extension<DB>,
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()
}