Class BeanMetadataPolicyOperator
java.lang.Object
net.shibboleth.oidc.metadata.policy.impl.BeanMetadataPolicyOperator
- All Implemented Interfaces:
CustomMetadataPolicyOperator,Aware,ApplicationContextAware
public class BeanMetadataPolicyOperator
extends Object
implements CustomMetadataPolicyOperator, ApplicationContextAware
A custom metadata policy operator that fetches a bean from
ApplicationContext and uses it for as
CustomMetadataPolicyOperator.- Since:
- 3.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ApplicationContextThe application context from where to fetch the custom policy operators.static final StringThe operator name to be used withinMetadataPolicycustom operators. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(Object inputValue, MetadataPolicy policy) Apply the operator for the given input that has the given metadata policy attached.protected CustomMetadataPolicyOperatorFetch the bean fromApplicationContextvia identifier set in the given policy.voidsetApplicationContext(ApplicationContext context) booleanvalidate(MetadataPolicy policy) Validate whether the operator is compatible with the other operators in the policy.
-
Field Details
-
BEAN_OPERATOR_NAME
The operator name to be used withinMetadataPolicycustom operators.- See Also:
-
applicationContext
The application context from where to fetch the custom policy operators.
-
-
Constructor Details
-
BeanMetadataPolicyOperator
public BeanMetadataPolicyOperator()
-
-
Method Details
-
validate
Description copied from interface:CustomMetadataPolicyOperatorValidate whether the operator is compatible with the other operators in the policy.- Specified by:
validatein interfaceCustomMetadataPolicyOperator- Parameters:
policy- The metadata policy to be used by the custom policy operator.- Returns:
- true if
-
apply
public Object apply(@Nullable Object inputValue, @Nonnull MetadataPolicy policy) throws ConstraintViolationException Description copied from interface:CustomMetadataPolicyOperatorApply the operator for the given input that has the given metadata policy attached.- Specified by:
applyin interfaceCustomMetadataPolicyOperator- Parameters:
inputValue- The value to be used by the custom policy operator.policy- The metadata policy to be used by the custom policy operator.- Returns:
- The value returned by the custom policy operator.
- Throws:
ConstraintViolationException- If the value-check of the custom operator fails.
-
fetchPolicyOperatorBean
@Nonnull protected CustomMetadataPolicyOperator fetchPolicyOperatorBean(@Nonnull MetadataPolicy policy) throws ConstraintViolationException Fetch the bean fromApplicationContextvia identifier set in the given policy.- Parameters:
policy- The metadata policy possibly containing the bean operator.- Returns:
- The bean whose identifier matches the one given in the policy.
- Throws:
ConstraintViolationException- If the matching bean could not be wired or its id could not be parsed.
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-