Struct cedar_policy::Request
source · pub struct Request(/* private fields */);
Expand description
Represents the request tuple <P, A, R, C> (see the Cedar design doc).
Implementations§
source§impl Request
impl Request
sourcepub fn new(
principal: Option<EntityUid>,
action: Option<EntityUid>,
resource: Option<EntityUid>,
context: Context,
schema: Option<&Schema>
) -> Result<Self, RequestValidationError>
pub fn new( principal: Option<EntityUid>, action: Option<EntityUid>, resource: Option<EntityUid>, context: Context, schema: Option<&Schema> ) -> Result<Self, RequestValidationError>
Create a Request.
Note that you can create the EntityUid
s using .parse()
on any
string (via the FromStr
implementation for EntityUid
).
The principal, action, and resource fields are optional to support
the case where these fields do not contribute to authorization
decisions (e.g., because they are not used in your policies).
If any of the fields are None
, we will automatically generate
a unique entity UID that is not equal to any UID in the store.
If schema
is present, this constructor will validate that the
Request
complies with the given schema
.
sourcepub fn principal(&self) -> Option<&EntityUid>
pub fn principal(&self) -> Option<&EntityUid>
Get the principal component of the request. Returns None
if the principal is
“unspecified” (i.e., constructed by passing None
into the constructor) or
“unknown” (i.e., constructed using the partial evaluation APIs).