pub struct DogwoodAuthorization { /* private fields */ }Expand description
Authorizes each tool call against a Dogwood policy set (DogwoodAuthorization).
Holds temporal history, so one instance is one ordered history. Every temporal predicate is
pinned to the deciding principal, so one instance serves many principals without their
histories mixing. History is never pruned; reset drops every principal’s at
once.
A tool’s result is not recorded, only the fact that it returned (or failed), so a predicate on a result field type-checks and then never matches. A condition compares the tool arguments as the model emitted them, and a generated schema is typed to match: an enum parameter compares as a string and a number parameter as a whole number.
Implementations§
Source§impl DogwoodAuthorization
impl DogwoodAuthorization
Sourcepub fn new(config: DogwoodAuthorizationConfig) -> Result<Self>
pub fn new(config: DogwoodAuthorizationConfig) -> Result<Self>
A handler with these settings; the policy set is parsed, type-checked and lowered now.
§Errors
Neither action_schema nor tools; both principal and principal_resolver;
non-empty entities without action_schema; namespace with action_schema, or a
namespace that is not ::-separated Cedar identifiers; a principal of a type the
generated schema does not declare; a missing .dw or .cedarschema file; a policy set
that fails to parse or type-check against the schema (Dogwood policy validation failed: ..).
Trait Implementations§
Source§impl Debug for DogwoodAuthorization
impl Debug for DogwoodAuthorization
Source§impl InterventionHandler for DogwoodAuthorization
impl InterventionHandler for DogwoodAuthorization
Source§fn name(&self) -> &str
fn name(&self) -> &str
Confirm raises.Source§fn on_error(&self) -> OnError
fn on_error(&self) -> OnError
OnError::Throw.Source§fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 mut BeforeToolCallEvent,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeToolCallEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 mut BeforeToolCallEvent,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeToolCallEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn after_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 mut AfterToolCallEvent,
) -> Pin<Box<dyn Future<Output = InterventionResult<AfterToolCallEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 mut AfterToolCallEvent,
) -> Pin<Box<dyn Future<Output = InterventionResult<AfterToolCallEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn before_invocation<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut BeforeInvocationEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeInvocationEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_invocation<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut BeforeInvocationEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeInvocationEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn before_model_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut BeforeModelCallEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeModelCallEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_model_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut BeforeModelCallEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<BeforeModelCallEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn after_model_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut AfterModelCallEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<AfterModelCallEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_model_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
_event: &'life1 mut AfterModelCallEvent<'a>,
) -> Pin<Box<dyn Future<Output = InterventionResult<AfterModelCallEvent<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for DogwoodAuthorization
impl !RefUnwindSafe for DogwoodAuthorization
impl !UnwindSafe for DogwoodAuthorization
impl Send for DogwoodAuthorization
impl Sync for DogwoodAuthorization
impl Unpin for DogwoodAuthorization
impl UnsafeUnpin for DogwoodAuthorization
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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 more