pub struct SystemDbAuthorizer { /* private fields */ }Expand description
Answers authorization from a Corium database holding ReBAC policy.
Implementations§
Source§impl SystemDbAuthorizer
impl SystemDbAuthorizer
Sourcepub fn new(source: Arc<dyn PolicySource>) -> Self
pub fn new(source: Arc<dyn PolicySource>) -> Self
Builds an authorizer over source with default tuning.
Sourcepub fn with_config(source: Arc<dyn PolicySource>, config: AuthzConfig) -> Self
pub fn with_config(source: Arc<dyn PolicySource>, config: AuthzConfig) -> Self
Builds an authorizer over source.
Sourcepub fn with_audit(self, audit: Arc<dyn AuditSink>) -> Self
pub fn with_audit(self, audit: Arc<dyn AuditSink>) -> Self
Routes audit events to audit instead of tracing (builder style).
Sourcepub fn config(&self) -> &AuthzConfig
pub fn config(&self) -> &AuthzConfig
The tuning in force.
Sourcepub fn current_policy(&self) -> Option<Arc<Policy>>
pub fn current_policy(&self) -> Option<Arc<Policy>>
The compiled policy this process is deciding from, if it has one.
Sourcepub async fn refresh(&self) -> Result<Arc<Policy>, RefreshError>
pub async fn refresh(&self) -> Result<Arc<Policy>, RefreshError>
Reads the source and compiles a new snapshot when its basis has moved.
Safe to call from anywhere: it is what the refresh task loops on, what
a Fresh check calls, and what a caller uses to fail startup early on a
misconfigured authz database.
§Errors
Returns RefreshError when the snapshot cannot be read or compiled.
The last good policy is kept: a policy that stops compiling does not
silently become “deny everything” while the previous one still applies.
Sourcepub fn spawn_refresh(self: &Arc<Self>) -> JoinHandle<()>
pub fn spawn_refresh(self: &Arc<Self>) -> JoinHandle<()>
Spawns the background task that keeps the compiled snapshot current.
The task waits on the source’s change signal (a basis watch, a tx-report broadcast, or a poll), recompiles off the request path, and swaps the result in. It logs and retries on failure rather than exiting, so a transient store outage does not permanently freeze policy.
Sourcepub async fn check(
&self,
principal: &Principal,
access: &Access,
) -> AuthzDecision
pub async fn check( &self, principal: &Principal, access: &Access, ) -> AuthzDecision
Runs one check, returning the decision with its audit detail.
Trait Implementations§
Source§impl Authorizer for SystemDbAuthorizer
impl Authorizer for SystemDbAuthorizer
Auto Trait Implementations§
impl !Freeze for SystemDbAuthorizer
impl !RefUnwindSafe for SystemDbAuthorizer
impl !UnwindSafe for SystemDbAuthorizer
impl Send for SystemDbAuthorizer
impl Sync for SystemDbAuthorizer
impl Unpin for SystemDbAuthorizer
impl UnsafeUnpin for SystemDbAuthorizer
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
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>
T in a tonic::Request