diff --git a/src/graphql/auth.rs b/src/graphql/auth.rs
index 54ff884..9b6b286 100644
--- a/src/graphql/auth.rs
+++ b/src/graphql/auth.rs
@@ -14,12 +14,12 @@
use std::str::FromStr;
-use async_graphql::{Error, ErrorExtensions};
+use async_graphql::{Context, Error, ErrorExtensions, 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;
@@ -180,6 +180,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::