Record Class JSentinelRequirement
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.rest.openapi.JSentinelRequirement
- Record Components:
scheme- what kind of authorization the requirement describes; non-nulloperator- how the values combine; non-nullvalues- names of the required permissions / roles / policies; non-null, non-empty, immutable
@ExperimentalJSentinelApi
public record JSentinelRequirement(JSentinelRequirement.Scheme scheme, JSentinelRequirement.Operator operator, List<String> values)
extends Record
Adapter-neutral description of a single security requirement
extracted from a
@Requires… / @ProtectedBy
annotation on a REST handler. Multiple requirements compose
with AND semantics (the operation needs every requirement to
pass — same model as the runtime evaluator).
The values list is interpreted relative to
scheme and operator:
JSentinelRequirement.Scheme.PERMISSIONwithJSentinelRequirement.Operator.ALL— subject must have every listed permission.JSentinelRequirement.Scheme.PERMISSIONwithJSentinelRequirement.Operator.ANY— subject must have at least one.JSentinelRequirement.Scheme.ROLEwithJSentinelRequirement.Operator.ALL— subject must have every listed role.JSentinelRequirement.Scheme.POLICYwithJSentinelRequirement.Operator.ALL— every listed policy name must permit the request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow thevaluescombine.static enumWhat the requirement is about. -
Constructor Summary
ConstructorsConstructorDescriptionJSentinelRequirement(JSentinelRequirement.Scheme scheme, JSentinelRequirement.Operator operator, List<String> values) Validates the components and freezes the values list. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.operator()Returns the value of theoperatorrecord component.scheme()Returns the value of theschemerecord component.final StringtoString()Returns a string representation of this record class.values()Returns the value of thevaluesrecord component.
-
Constructor Details
-
JSentinelRequirement
public JSentinelRequirement(JSentinelRequirement.Scheme scheme, JSentinelRequirement.Operator operator, List<String> values) Validates the components and freezes the values list.
-
-
Method Details
-
toString
-
hashCode
-
equals
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. All components in this record class are compared withObjects::equals(Object,Object). -
scheme
-
operator
-
values
-