pub trait AuthorizationProvider: Send + Sync {
// Required method
fn check<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resource: &'life3 str,
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait;
// Provided methods
fn check_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
resource: &'life2 str,
operation: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait { ... }
fn check_batch_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
resources: &'life2 [String],
operation: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, Error>> + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait { ... }
fn check_batch<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resources: &'life3 [String],
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, Error>> + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Trait for pluggable authorization checks.
Decouples DiscoveryService from PolicyClient. The main hyprstream crate
provides a PolicyAuthProvider that wraps PolicyClient.
Required Methods§
Sourcefn check<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resource: &'life3 str,
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
fn check<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resource: &'life3 str,
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
Check if a subject is authorized for the given operation on a resource.
Provided Methods§
Sourcefn check_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
resource: &'life2 str,
operation: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn check_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
resource: &'life2 str,
operation: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Verified ingress context, including original holder evidence for service-mediated checks. Policy-backed providers override this seam.
fn check_batch_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 EnvelopeContext,
resources: &'life2 [String],
operation: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Sourcefn check_batch<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resources: &'life3 [String],
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
fn check_batch<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
subject: &'life1 str,
domain: &'life2 str,
resources: &'life3 [String],
operation: &'life4 str,
bearer: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
One bounded authorization vector; implementations may amortize RPC overhead but must retain one decision per resource in input order.