Package org.ow2.authzforce.core.pdp.api
Interface NamedAttributeProvider
-
- All Known Subinterfaces:
CloseableNamedAttributeProvider
- All Known Implementing Classes:
BaseNamedAttributeProvider
public interface NamedAttributeProvider
"Named" Attribute Provider, i.e. providing "named attribute(s)" as defined in ยง7.3 of XACML 3.0 specification (resolveAttributeDesignatorType
s in a specific way, e.g. from a specific attribute source):A named attribute is the term used for the criteria that the specific attribute designators use to refer to particular attributes in the
elements of the request context.
-
-
Field Summary
Fields Modifier and Type Field Description static UnsupportedOperationException
NOT_IMPLEMENTED_EXCEPTION
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
beginIndividualDecisionRequest(EvaluationContext individualDecisionContext, Optional<EvaluationContext> mdpContext)
The PDP engine calls this method before evaluating each Individual Decision Request (whether it is part of a Multiple Decision request or not) if the Attribute Provider supports it as indicated bysupportsBeginIndividualDecisionRequest()
.default void
beginMultipleDecisionRequest(EvaluationContext mdpContext)
When the Multiple Decision Profile is used, the PDP engine calls this method before evaluating the Individual Decision Requests of a given Multiple Decision request if the Attribute Provider supports it as indicated bysupportsBeginMultipleDecisionRequest()
..<AV extends AttributeValue>
AttributeBag<AV>get(AttributeFqn attributeFQN, Datatype<AV> datatype, EvaluationContext individualDecisionContext, Optional<EvaluationContext> mdpContext)
Provides values of the attribute matching the given designator data.Set<oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType>
getProvidedAttributes()
Returns the non-null non-emptySet
ofAttributeDesignator
s provided/supported by this Attribute provider.default boolean
supportsBeginIndividualDecisionRequest()
Indicates support ofbeginIndividualDecisionRequest(EvaluationContext, Optional)
, i.e.default boolean
supportsBeginMultipleDecisionRequest()
Indicates support ofbeginMultipleDecisionRequest(EvaluationContext)
, i.e.
-
-
-
Field Detail
-
NOT_IMPLEMENTED_EXCEPTION
static final UnsupportedOperationException NOT_IMPLEMENTED_EXCEPTION
-
-
Method Detail
-
getProvidedAttributes
Set<oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType> getProvidedAttributes()
Returns the non-null non-emptySet
ofAttributeDesignator
s provided/supported by this Attribute provider. EachAttributeDesignatorType.getCategory()
must return a non-null/non-empty value If any AttributeDesignator in the set does not specify an AttributeId (getAttributeId() = null), the Attribute provider is considered a category-wide attribute provider for the category (returned byAttributeDesignatorType.getCategory()
), i.e. may provide any attribute in this category.- Returns:
- a non-null non-empty
Set
of supportedAttributeDesignatorType
s
-
supportsBeginMultipleDecisionRequest
default boolean supportsBeginMultipleDecisionRequest()
Indicates support ofbeginMultipleDecisionRequest(EvaluationContext)
, i.e. whether this method must be called on this attribute provider at the beginning of each Multiple Decision Request evaluation- Returns:
- true iff
beginMultipleDecisionRequest(EvaluationContext)
is supported/implemented. If true, thenbeginMultipleDecisionRequest(EvaluationContext)
must be implemented.
-
beginMultipleDecisionRequest
default void beginMultipleDecisionRequest(EvaluationContext mdpContext)
When the Multiple Decision Profile is used, the PDP engine calls this method before evaluating the Individual Decision Requests of a given Multiple Decision request if the Attribute Provider supports it as indicated bysupportsBeginMultipleDecisionRequest()
.. This enables the attribute provider to set attributes and/or variables in the scope of the Multiple Decision Request, therefore reuse the same values in all its Individual Decision Requests. A typical use case is an AttributeProvider providing the current date/time which should be the same for all Individual Decision requests within the same Multiple Decision request in order to be consistent (e.g. AuthzForce built-in StandardEnvironmentAttributeProvider configured with override=true). In this case, the AttributeProvider may set the current date/time once and for all on themdpContext
for a given Multiple Decision request, and reuse it later for each Individual Decision context inget(AttributeFqn, Datatype, EvaluationContext, Optional)
.- Parameters:
mdpContext
- context of a Multiple Decision request evaluation, will be passed on asmdpContext
argument ofget(AttributeFqn, Datatype, EvaluationContext, Optional)
when Individual Decision requests are evaluated.
-
supportsBeginIndividualDecisionRequest
default boolean supportsBeginIndividualDecisionRequest()
Indicates support ofbeginIndividualDecisionRequest(EvaluationContext, Optional)
, i.e. whether this method must be called on this attribute provider at the beginning of each Individual Decision Request evaluation- Returns:
- true iff
beginIndividualDecisionRequest(EvaluationContext, Optional)
is supported/implemented. If true, thenbeginIndividualDecisionRequest(EvaluationContext, Optional)
must be implemented.
-
beginIndividualDecisionRequest
default void beginIndividualDecisionRequest(EvaluationContext individualDecisionContext, Optional<EvaluationContext> mdpContext) throws IndeterminateEvaluationException
The PDP engine calls this method before evaluating each Individual Decision Request (whether it is part of a Multiple Decision request or not) if the Attribute Provider supports it as indicated bysupportsBeginIndividualDecisionRequest()
. This enables the attribute provider to do some validation of the request (e.g. check dependency attributes) and/or set/override attributes or variables of the request before the policy evaluation begins, therefore reuse those values for its benefit during the evaluation. A typical use case is an AttributeProvider providing the current date/time, e.g. either overriding current-* attributes (override mode) of the request or checking that current-date and current-time are consistent with current-dateTime.- Parameters:
mdpContext
- context of a Multiple Decision request evaluation, will be passed on asmdpContext
argument ofget(AttributeFqn, Datatype, EvaluationContext, Optional)
when AttributeDesignator/AttributeSelector are evaluated for a given Individual Decision request.- Throws:
IndeterminateEvaluationException
-
get
<AV extends AttributeValue> AttributeBag<AV> get(AttributeFqn attributeFQN, Datatype<AV> datatype, EvaluationContext individualDecisionContext, Optional<EvaluationContext> mdpContext) throws IndeterminateEvaluationException
Provides values of the attribute matching the given designator data. If no value found, but no other error occurred, an empty bag is returned.- Parameters:
attributeFQN
- the global identifier (Category,Issuer,AttributeId) of the attribute to find, must match one of the AttributeDesignatorTypes returned bygetProvidedAttributes()
individualDecisionContext
- the (Individual Decision) request contextmdpContext
- * the context of the Multiple Decision request that theindividualDecisionContext
belongs to if the Multiple Decision Profile is used; same as themdpContext
parameter ofbeginMultipleDecisionRequest(EvaluationContext)
.datatype
- attribute datatype, must match the data-type of the AttributeDesignatorType matchingattributeFQN
in thegetProvidedAttributes()
's result set- Returns:
- the result of retrieving the attribute, which will be a bag of values of type defined by
returnDatatype
; empty bag iff no value found and no error occurred. - Throws:
UnsupportedOperationException
-attributeFQN
orreturnDatatype
are not supported (the PDP engine should try another attribute provider if any)IndeterminateEvaluationException
-attributeFQN
orreturnDatatype
are supported but some error occurred while trying to resolve the attribute value(s)
-
-