diff --git a/src/graphql/auth.rs b/src/graphql/auth.rs
index 074eb32..dc0cbe7 100644
--- a/src/graphql/auth.rs
+++ b/src/graphql/auth.rs
@@ -14,11 +14,12 @@
use std::str::FromStr;
+use async_graphql::{Context, Guard};
use axum_extra::headers::authorization::Bearer;
use axum_extra::headers::Authorization;
use derive_more::{Display, Error, From};
use serde::{Deserialize, Serialize};
-use tracing::info;
+use tracing::{info, trace};
use crate::cli::PolicyOptions;
@@ -176,6 +177,49 @@ impl PolicyCheck {
}
}
+#[derive(Debug)]
+pub(crate) enum AuthGuard<'a> {
+ Access {
+ instrument: &'a str,
+ instrument_session: &'a str,
+ },
+ InstrumentAdmin {
+ instrument: &'a str,
+ },
+ Admin,
+}
+
+impl<'a> Guard for AuthGuard<'a> {
+ async fn check(&self, ctx: &Context<'_>) -> async_graphql::Result<()> {
+ if let Some(policy) = ctx.data::