pub struct SecurityService { /* private fields */ }Expand description
Security service combining all security components
Implementations§
Source§impl SecurityService
impl SecurityService
Sourcepub fn new(config: SecurityConfig) -> Self
pub fn new(config: SecurityConfig) -> Self
Create a new security service
Sourcepub fn register_api_key(&self, key: &str, principal: Principal)
pub fn register_api_key(&self, key: &str, principal: Principal)
Register an API key
Sourcepub fn authenticate(
&self,
auth_header: Option<&str>,
client_cert: Option<&str>,
) -> Result<Principal, AuthError>
pub fn authenticate( &self, auth_header: Option<&str>, client_cert: Option<&str>, ) -> Result<Principal, AuthError>
Authenticate a request (returns principal if valid)
Authorize an action
Sourcepub fn check_rate_limit(&self, principal: &Principal) -> Result<(), AuthError>
pub fn check_rate_limit(&self, principal: &Principal) -> Result<(), AuthError>
Check rate limit
Sourcepub fn audit(&self) -> &AuditLogger
pub fn audit(&self) -> &AuditLogger
Get audit logger
Auto Trait Implementations§
impl !Freeze for SecurityService
impl !RefUnwindSafe for SecurityService
impl Send for SecurityService
impl Sync for SecurityService
impl Unpin for SecurityService
impl UnsafeUnpin for SecurityService
impl UnwindSafe for SecurityService
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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