fix(auth): isolate embedded IAM contexts (#5704)

This commit is contained in:
Zhengchao An
2026-08-04 23:12:35 +08:00
committed by GitHub
parent c26419e357
commit 1695873e55
6 changed files with 161 additions and 22 deletions
+9
View File
@@ -168,6 +168,15 @@ pub async fn build_iam_sys(ecstore: Arc<IamStore>) -> Result<Arc<IamSys<ObjectSt
Ok(Arc::new(IamSys::new(cache_manager)))
}
/// Build an IAM system for an application context and publish the first one
/// as the ambient compatibility default.
#[instrument(skip(ecstore))]
pub async fn init_iam_sys_for_context(ecstore: Arc<IamStore>) -> Result<Arc<IamSys<ObjectStore>>> {
let iam_instance = build_iam_sys(ecstore).await?;
let _ = IAM_SYS.set(iam_instance.clone());
Ok(iam_instance)
}
#[instrument(skip(ecstore))]
pub async fn init_iam_sys(ecstore: Arc<IamStore>) -> Result<Arc<IamSys<ObjectStore>>> {
if let Some(existing) = IAM_SYS.get() {