Vyom Mani Tiwari created RANGER-5848:
----------------------------------------
Summary: Add constraints to RangerAccessResult
Key: RANGER-5848
URL: https://issues.apache.org/jira/browse/RANGER-5848
Project: Ranger
Issue Type: Improvement
Components: Ranger
Reporter: Vyom Mani Tiwari
Assignee: Vyom Mani Tiwari
Constraint policies (RANGER-5838) let an allowed access carry constraints that
the caller must enforce, such as {{{}requireApproval{}}}. This sub-task adds
the result API that carries those constraints from the policy engine to
plugins. Plugins and callers like the Agent Harness can start integrating
against it before policy evaluation (RANGER-5842) lands.
_Changes_
* *New {{{}RangerConstraintResult{}}}:* {{{}constraintName{}}}, {{parameters}}
({{{}Map<String, Object>{}}}, copied on construction), {{{}policyId{}}},
{{{}policyVersion{}}}, {{{}policyPriority{}}}, {{{}matchType{}}}.
* *{{{}RangerConstraintResult.ConstraintResultComparator{}}}:* sorts by
constraint name, then policy priority, then match type, then policy id, so
enforcement can choose the applicable constraint.
* *{{{}RangerAccessResult{}}}:*
** new {{constraints}} ({{{}List<RangerConstraintResult>{}}});
** {{getConstraints()}} returns an empty list when none are set;
** new {{setConstraints()}} and {{{}addConstraint(){}}};
** constraints are copied in {{{}setAccessResultFrom(){}}};
** constraints are cleared when the result is set to deny
({{{}setIsAllowed(false){}}}).
* *{{{}RangerBasePlugin{}}}:* when a chained plugin’s result is allowed, its
constraints are copied into the final result.
The policy engine doesn’t populate {{constraints}} yet; RANGER-5842 adds that.
Until then, the list is always empty and existing behavior doesn’t change.
_Testing:_ unit tests for:
* {{{}RangerConstraintResult{}}}: construction, parameter copy,
{{{}equals{}}}/{{{}hashCode{}}}/{{{}toString{}}}, and comparator ordering;
* {{{}RangerAccessResult{}}}: the empty default, add/set, copy in
{{{}setAccessResultFrom{}}}, and clearing on deny.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)