pub struct NamespaceAuth {
pub allow_anonymous_default: bool,
/* private fields */
}Expand description
Auth layer for namespace-based access control
Fields§
§allow_anonymous_default: boolAllow unauthenticated access to “default” namespace
Implementations§
Source§impl NamespaceAuth
impl NamespaceAuth
pub fn new() -> Self
Sourcepub fn register_token(
&self,
token: &str,
namespaces: Vec<String>,
permissions: NamespacePermission,
)
pub fn register_token( &self, token: &str, namespaces: Vec<String>, permissions: NamespacePermission, )
Register a token with access to specific namespaces
Sourcepub fn check(
&self,
token: Option<&str>,
namespace: &str,
operation: &str,
) -> Result<(), String>
pub fn check( &self, token: Option<&str>, namespace: &str, operation: &str, ) -> Result<(), String>
Check if token has permission for namespace and operation
Sourcepub fn load_from_env(&self)
pub fn load_from_env(&self)
Load tokens from environment variable (JSON format)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NamespaceAuth
impl RefUnwindSafe for NamespaceAuth
impl Send for NamespaceAuth
impl Sync for NamespaceAuth
impl Unpin for NamespaceAuth
impl UnwindSafe for NamespaceAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request