Record Class ApprovalService.Policy

java.lang.Object
java.lang.Record
zeroecho.pki.server.ApprovalService.Policy
Record Components:
policyId - stable policy identity
threshold - required distinct approvals
eligibleApprovers - finite M-set, empty only when a required role defines eligibility
requiredRoleTemplateIds - eligible approver role-template IDs
requesterSeparation - whether the requester is barred from approving
lifetime - positive approval lifetime
justificationRequired - whether a nonblank justification is mandatory
Enclosing class:
ApprovalService

public static record ApprovalService.Policy(String policyId, int threshold, Set<String> eligibleApprovers, Set<String> requiredRoleTemplateIds, boolean requesterSeparation, Duration lifetime, boolean justificationRequired) extends Record
Immutable approval policy.
  • Constructor Details

    • Policy

      public Policy(String policyId, int threshold, Set<String> eligibleApprovers, Set<String> requiredRoleTemplateIds, boolean requesterSeparation, Duration lifetime, boolean justificationRequired)
      Validates the finite N-of-M policy.
  • Method Details

    • commitment

      public String commitment()
      Returns a stable commitment for this policy.
      Returns:
      lowercase SHA-256 commitment to the complete policy
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • policyId

      public String policyId()
      Returns the value of the policyId record component.
      Returns:
      the value of the policyId record component
    • threshold

      public int threshold()
      Returns the value of the threshold record component.
      Returns:
      the value of the threshold record component
    • eligibleApprovers

      public Set<String> eligibleApprovers()
      Returns the value of the eligibleApprovers record component.
      Returns:
      the value of the eligibleApprovers record component
    • requiredRoleTemplateIds

      public Set<String> requiredRoleTemplateIds()
      Returns the value of the requiredRoleTemplateIds record component.
      Returns:
      the value of the requiredRoleTemplateIds record component
    • requesterSeparation

      public boolean requesterSeparation()
      Returns the value of the requesterSeparation record component.
      Returns:
      the value of the requesterSeparation record component
    • lifetime

      public Duration lifetime()
      Returns the value of the lifetime record component.
      Returns:
      the value of the lifetime record component
    • justificationRequired

      public boolean justificationRequired()
      Returns the value of the justificationRequired record component.
      Returns:
      the value of the justificationRequired record component