Skip to content

Commit 8e9997c

Browse files
committed
chore: expose
1 parent 2ba752d commit 8e9997c

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

packages/cubejs-backend-native/src/auth.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ impl AuthContext for NativeSQLAuthContext {
7878
fn as_any(&self) -> &dyn Any {
7979
self
8080
}
81+
82+
fn user(&self) -> Option<&String> {
83+
self.user.as_ref()
84+
}
85+
86+
fn security_context(&self) -> Option<&serde_json::Value> {
87+
self.security_context.as_ref()
88+
}
8189
}
8290

8391
#[async_trait]
@@ -140,6 +148,14 @@ impl GatewayAuthContext for NativeGatewayAuthContext {
140148
fn as_any(&self) -> &dyn Any {
141149
self
142150
}
151+
152+
fn user(&self) -> Option<&String> {
153+
None
154+
}
155+
156+
fn security_context(&self) -> Option<&serde_json::Value> {
157+
self.security_context.as_ref()
158+
}
143159
}
144160

145161
#[derive(Debug, Serialize)]

packages/cubejs-backend-native/src/gateway/auth_service.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use serde::Serialize;
88
// Any type will allow us to split (with downcast) auth context
99
pub trait GatewayAuthContext: Debug + Send + Sync {
1010
fn as_any(&self) -> &dyn Any;
11+
12+
fn user(&self) -> Option<&String>;
13+
14+
fn security_context(&self) -> Option<&serde_json::Value>;
1115
}
1216

1317
pub type GatewayAuthContextRef = Arc<dyn GatewayAuthContext>;

rust/cubesql/cubesql/src/sql/auth_service.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use crate::CubeError;
88
// Any type will allow us to split (with downcast) auth context into HTTP (standalone) or Native
99
pub trait AuthContext: Debug + Send + Sync {
1010
fn as_any(&self) -> &dyn Any;
11+
12+
fn user(&self) -> Option<String>;
13+
14+
fn security_context(&self) -> Option<&serde_json::Value>;
1115
}
1216

1317
pub type AuthContextRef = Arc<dyn AuthContext>;

0 commit comments

Comments
 (0)