Package com.cedarpolicy.model
Class AuthorizationResponse
java.lang.Object
com.cedarpolicy.model.AuthorizationResponse
The result of processing an AuthorizationRequest. The answer to the request is contained in the
decision field. Decision will be set to NoDecision in the event of a parse error in submitted
slice. The reasons field contains all the policies that caused Cedar to make a decision. The
field advice contains the Advice String for each policy in reasons. The field errors contains a
list of errors encountered during request processing. Some errors will still result in a decision
being reached, please see the Cedar Spec for more information.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe three possible results of request evaluation.static classThe reasons and errors from a request evaluation. -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizationResponse(AuthorizationResponse.Decision decision, AuthorizationResponse.Diagnostics diagnostics) Construct an authorization response. -
Method Summary
Modifier and TypeMethodDescriptionResult of the request evaluation.Set of errors and warnings returned by Cedar.Set of policyID's that caused the decision.booleanCheck authorization decision.booleanCheck if the evaluator was able to reach a decision.
-
Constructor Details
-
AuthorizationResponse
public AuthorizationResponse(AuthorizationResponse.Decision decision, AuthorizationResponse.Diagnostics diagnostics) Construct an authorization response.- Parameters:
decision- authorization decision for the given requestdiagnostics- a collection of policies that contributed to the result and any errors that might have happened during evaluation
-
-
Method Details
-
getDecision
Result of the request evaluation.- Returns:
AuthorizationResponse.Decisionthat contains the result for a given request
-
getReasons
Set of policyID's that caused the decision. For example, when a policy evaluates to Deny, all deny policies that evaluated to True will appear in Reasons.- Returns:
- list with the policy ids that contributed to the decision
-
getErrors
Set of errors and warnings returned by Cedar.- Returns:
- list with errors that happened for a given Request
-
isAllowed
public boolean isAllowed()Check authorization decision.- Returns:
- true if the request evaluated to Allow.
-
reachedDecision
public boolean reachedDecision()Check if the evaluator was able to reach a decision.- Returns:
- true if the request evaluated to either Allow or Deny.
-