pub struct PartialResponse {
pub satisfied_permits: HashMap<PolicyID, Arc<Annotations>>,
pub false_permits: HashMap<PolicyID, (ErrorState, Arc<Annotations>)>,
pub residual_permits: HashMap<PolicyID, (Arc<Expr>, Arc<Annotations>)>,
pub satisfied_forbids: HashMap<PolicyID, Arc<Annotations>>,
pub false_forbids: HashMap<PolicyID, (ErrorState, Arc<Annotations>)>,
pub residual_forbids: HashMap<PolicyID, (Arc<Expr>, Arc<Annotations>)>,
pub errors: Vec<AuthorizationError>,
/* private fields */
}
Expand description
A partially evaluated authorization response.
Splits the results into several categories: satisfied, false, and residual for each policy effect.
Also tracks all the errors that were encountered during evaluation.
This structure currently has to own all of the PolicyID
objects due to the Self::reauthorize
method. If PolicySet
could borrow its PolicyID/contents then this whole structured could be borrowed.
Fields§
§satisfied_permits: HashMap<PolicyID, Arc<Annotations>>
All of the Effect::Permit
policies that were satisfied
false_permits: HashMap<PolicyID, (ErrorState, Arc<Annotations>)>
All of the Effect::Permit
policies that were not satisfied
residual_permits: HashMap<PolicyID, (Arc<Expr>, Arc<Annotations>)>
All of the Effect::Permit
policies that evaluated to a residual
satisfied_forbids: HashMap<PolicyID, Arc<Annotations>>
All of the Effect::Forbid
policies that were satisfied
false_forbids: HashMap<PolicyID, (ErrorState, Arc<Annotations>)>
All of the Effect::Forbid
policies that were not satisfied
residual_forbids: HashMap<PolicyID, (Arc<Expr>, Arc<Annotations>)>
All of the Effect::Forbid
policies that evaluated to a residual
errors: Vec<AuthorizationError>
All of the policy errors encountered during evaluation
Implementations§
Source§impl PartialResponse
impl PartialResponse
Sourcepub fn new(
true_permits: impl IntoIterator<Item = (PolicyID, Arc<Annotations>)>,
false_permits: impl IntoIterator<Item = (PolicyID, (ErrorState, Arc<Annotations>))>,
residual_permits: impl IntoIterator<Item = (PolicyID, (Arc<Expr>, Arc<Annotations>))>,
true_forbids: impl IntoIterator<Item = (PolicyID, Arc<Annotations>)>,
false_forbids: impl IntoIterator<Item = (PolicyID, (ErrorState, Arc<Annotations>))>,
residual_forbids: impl IntoIterator<Item = (PolicyID, (Arc<Expr>, Arc<Annotations>))>,
errors: impl IntoIterator<Item = AuthorizationError>,
request: Arc<Request>,
) -> Self
pub fn new( true_permits: impl IntoIterator<Item = (PolicyID, Arc<Annotations>)>, false_permits: impl IntoIterator<Item = (PolicyID, (ErrorState, Arc<Annotations>))>, residual_permits: impl IntoIterator<Item = (PolicyID, (Arc<Expr>, Arc<Annotations>))>, true_forbids: impl IntoIterator<Item = (PolicyID, Arc<Annotations>)>, false_forbids: impl IntoIterator<Item = (PolicyID, (ErrorState, Arc<Annotations>))>, residual_forbids: impl IntoIterator<Item = (PolicyID, (Arc<Expr>, Arc<Annotations>))>, errors: impl IntoIterator<Item = AuthorizationError>, request: Arc<Request>, ) -> Self
Create a partial response from each of the policy result categories
Sourcepub fn concretize(self) -> Response
pub fn concretize(self) -> Response
Convert this response into a concrete evaluation response. All residuals are treated as errors
Sourcepub fn decision(&self) -> Option<Decision>
pub fn decision(&self) -> Option<Decision>
Attempt to reach a partial decision; the presence of residuals may result in returning None
,
indicating that a decision could not be reached given the unknowns
Sourcepub fn definitely_satisfied(&self) -> impl Iterator<Item = Policy> + '_
pub fn definitely_satisfied(&self) -> impl Iterator<Item = Policy> + '_
Returns the set of PolicyID
s that were definitely satisfied – both permits and forbids
Sourcepub fn definitely_errored(&self) -> impl Iterator<Item = &PolicyID>
pub fn definitely_errored(&self) -> impl Iterator<Item = &PolicyID>
Returns the set of PolicyID
s that encountered errors
Sourcepub fn may_be_determining(&self) -> impl Iterator<Item = Policy> + '_
pub fn may_be_determining(&self) -> impl Iterator<Item = Policy> + '_
Returns an over-approximation of the set of determining policies.
This is all policies that may be determining for any substitution of the unknowns.
Sourcepub fn must_be_determining(&self) -> impl Iterator<Item = Policy> + '_
pub fn must_be_determining(&self) -> impl Iterator<Item = Policy> + '_
Returns an under-approximation of the set of determining policies.
This is all policies that must be determining for all possible substitutions of the unknowns.
Sourcepub fn nontrivial_residuals(&self) -> impl Iterator<Item = Policy> + '_
pub fn nontrivial_residuals(&self) -> impl Iterator<Item = Policy> + '_
Returns the set of non-trivial (meaning more than just true
or false
) residuals expressions
Sourcepub fn nontrivial_residual_ids(&self) -> impl Iterator<Item = &PolicyID>
pub fn nontrivial_residual_ids(&self) -> impl Iterator<Item = &PolicyID>
Returns the set of ids of non-trivial (meaning more than just true
or false
) residuals expressions
Sourcepub fn nontrival_forbids(&self) -> impl Iterator<Item = Policy> + '_
pub fn nontrival_forbids(&self) -> impl Iterator<Item = Policy> + '_
Returns the set of non-trivial (meaning more than just true
or false
) residuals expressions from Effect::Forbid
Sourcepub fn all_residuals(&self) -> impl Iterator<Item = Policy> + '_
pub fn all_residuals(&self) -> impl Iterator<Item = Policy> + '_
Returns every policy residual, including trivial ones
Sourcepub fn get(&self, id: &PolicyID) -> Option<Policy>
pub fn get(&self, id: &PolicyID) -> Option<Policy>
Return the residual for a given PolicyID
, if it exists in the response
Attempt to re-authorize this response given a mapping from unknowns to values
Trait Implementations§
Source§impl Clone for PartialResponse
impl Clone for PartialResponse
Source§fn clone(&self) -> PartialResponse
fn clone(&self) -> PartialResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PartialResponse
impl Debug for PartialResponse
Source§impl From<PartialResponse> for Response
impl From<PartialResponse> for Response
Source§fn from(p: PartialResponse) -> Self
fn from(p: PartialResponse) -> Self
Auto Trait Implementations§
impl Freeze for PartialResponse
impl RefUnwindSafe for PartialResponse
impl Send for PartialResponse
impl Sync for PartialResponse
impl Unpin for PartialResponse
impl UnwindSafe for PartialResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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