mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-25 16:03:47 +00:00
* feat: add parent_workspace claim to OIDC job tokens for fork workspaces Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor: rename claim to fork_parent_workspace for clarity Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: update ee-repo-ref to e2df172596e00877068d4b0a98afaef62fe429d1 This commit updates the EE repository reference after PR #651 was merged in windmill-ee-private. Previous ee-repo-ref: f73001ac6c038694cfc2604233a59be1c0daa40b New ee-repo-ref: e2df172596e00877068d4b0a98afaef62fe429d1 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
97 lines
2.6 KiB
Rust
97 lines
2.6 KiB
Rust
#[cfg(feature = "private")]
|
|
#[allow(unused)]
|
|
pub use crate::oidc_ee::*;
|
|
|
|
/*
|
|
* Author: Ruben Fiszel
|
|
* Copyright: Windmill Labs, Inc 2023
|
|
* This file and its contents are licensed under the AGPLv3 License.
|
|
* Please see the included NOTICE for copyright information and
|
|
* LICENSE-AGPL for a copy of the license.
|
|
*/
|
|
|
|
#[cfg(not(feature = "private"))]
|
|
use serde::{Deserialize, Serialize};
|
|
#[cfg(not(feature = "private"))]
|
|
use tokio::sync::RwLock;
|
|
#[cfg(all(
|
|
feature = "enterprise",
|
|
feature = "openidconnect",
|
|
not(feature = "private")
|
|
))]
|
|
use {
|
|
crate::db::DB,
|
|
crate::{
|
|
auth::IdToken as WindmillIdToken,
|
|
error::{Error, Result},
|
|
},
|
|
anyhow,
|
|
};
|
|
|
|
#[cfg(all(feature = "openidconnect", not(feature = "private")))]
|
|
use openidconnect::AdditionalClaims;
|
|
|
|
#[cfg(all(feature = "openidconnect", not(feature = "private")))]
|
|
impl AdditionalClaims for JobClaim {}
|
|
|
|
#[cfg(all(feature = "openidconnect", not(feature = "private")))]
|
|
impl AdditionalClaims for WorkspaceClaim {}
|
|
|
|
#[cfg(all(feature = "openidconnect", not(feature = "private")))]
|
|
impl AdditionalClaims for InstanceClaim {}
|
|
|
|
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
|
|
#[cfg(not(feature = "private"))]
|
|
pub struct WorkspaceClaim {
|
|
pub workspace: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
|
|
#[cfg(not(feature = "private"))]
|
|
pub struct InstanceClaim {}
|
|
|
|
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
|
|
#[cfg(not(feature = "private"))]
|
|
pub struct JobClaim {
|
|
pub job_id: String,
|
|
pub path: Option<String>,
|
|
pub flow_path: Option<String>,
|
|
pub groups: Vec<String>,
|
|
pub username: String,
|
|
pub email: String,
|
|
pub workspace: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub fork_parent_workspace: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub end_user_email: Option<String>,
|
|
}
|
|
|
|
#[cfg(not(feature = "private"))]
|
|
lazy_static::lazy_static! {
|
|
static ref PRIVATE_KEY: RwLock<Option<String>> = RwLock::new(None);
|
|
}
|
|
|
|
#[cfg(not(feature = "private"))]
|
|
pub async fn generate_id_token<T: AdditionalClaims>(
|
|
_db: Option<&DB>,
|
|
_claim: T,
|
|
_audience: &str,
|
|
_identifier: String,
|
|
_email: Option<String>,
|
|
) -> Result<WindmillIdToken> {
|
|
Err(Error::internal_err(
|
|
"Not implemented in Windmill's Open Source repository".to_string(),
|
|
))
|
|
}
|
|
|
|
#[cfg(all(
|
|
feature = "enterprise",
|
|
feature = "openidconnect",
|
|
not(feature = "private")
|
|
))]
|
|
pub async fn get_private_key(_db: Option<&DB>) -> anyhow::Result<String> {
|
|
Err(anyhow::anyhow!(
|
|
"Not implemented in Windmill's Open Source repository"
|
|
))
|
|
}
|