Interface Validator<V>
- Type Parameters:
V- type of the value to be validated
- All Superinterfaces:
net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
- All Known Implementing Classes:
AbstractX509Validator,AcceptAllValidator,AcceptStringRegexValidator,AcceptStringValueValidator,AsDomainNameStringValidator,AsLiteralTailStringValidator,AsURLStringValidator,BaseAsValidator,EmptyPortURLValidator,HTTPSProtocolURLValidator,MissingHostURLValidator,RejectAllValidator,RejectDomainNameNotUnderPublicSuffixValidator,RejectDomainNamePublicSuffixValidator,RejectStringRegexValidator,RejectStringValueValidator,ValidatorSequence,X509DSADetector,X509ROCAValidator,X509RSAExponentValidator,X509RSAKeyLengthValidator,X509RSAOpenSSLKeylistValidator
Item,
to which status metadata will be added when appropriate.
A validate call may be provided with a "value context" String indicating
the larger validation of which this call is a component. For example, a validation of
the host component of a URL value might be provided with a value context of the
entire URL. If the value context is not required, it may be omitted either by passing null
or by using the validate method lacking that parameter.
The interface provides default method bodies for both forms of validate so
that implementing classes only need to provide one or the other in most cases.
Validators must be thread-safe.
- Since:
- 0.9.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumValidatorinstances are normally applied in sequence in a chain of responsibility pattern orchestrated by the caller. -
Method Summary
Modifier and TypeMethodDescriptiondefault Validator.ActionApply the validator to a value in the context of the givenItem.default Validator.ActionApply the validator to a value in the context of the givenItem.Methods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiableComponent
setIdMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Method Details
-
validate
@Nonnull default Validator.Action validate(@Nonnull V value, @Nonnull Item<?> item, @Nonnull String callerId, @Nullable String valueContext) throws StageProcessingException Apply the validator to a value in the context of the givenItem.The validator influences future processing by adding item metadata to the
Item.A common case is that the validator will add a
StatusMetadatato theItem, for example aErrorStatus. In this case, the convention is that thecomponentIdof theErrorStatuswould be created by combining thecallerIdwith a/and the validator's own identifier. For example, a validatorvalcalled by a stagestagewould normally use acomponentIdofstage/val.The
valueContextmakes the original context of thevalueavailable to help in constructing meaningful error messages. For example, the validation of a complex structured value such as a URI might be broken down into multiple sub-validations of its components: scheme, for example. When relevant, thevalueContextprovides a representation of the original complex value whilevalueis the component currently being validated.- Parameters:
value- the value to be validateditem- theItemcontext for the validationcallerId- aStringidentifying the callervalueContext- an additionalStringindicating the value context, ornull- Returns:
- an indication of whether to process additional validators
- Throws:
StageProcessingException- if an error occurs during validation- Since:
- 0.10.0
-
validate
@Nonnull default Validator.Action validate(@Nonnull V value, @Nonnull Item<?> item, @Nonnull String callerId) throws StageProcessingException Apply the validator to a value in the context of the givenItem.The validator influences future processing by adding item metadata to the
Item.A common case is that the validator will add a
StatusMetadatato theItem, for example aErrorStatus. In this case, the convention is that thecomponentIdof theErrorStatuswould be created by combining thecallerIdwith a/and the validator's own identifier. For example, a validatorvalcalled by a stagestagewould normally use acomponentIdofstage/val.- Parameters:
value- the value to be validateditem- theItemcontext for the validationcallerId- aStringidentifying the caller- Returns:
- an indication of whether to process additional validators
- Throws:
StageProcessingException- if an error occurs during validation
-