Class AsLiteralTailStringValidator
- All Implemented Interfaces:
Validator<String>,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
Validator that assists in the validation of regular-expression <shibmd:Scope>
values that include a literal tail.
A literal tail is:
- a sequence of at least two domain labels
- separated by literal
'.'characters (encoded in the regular expression as'\.' - explicitly anchored at the end of the regular expression
- preceded by anything terminating with an encoded literal
'.'
For example, the literal tail in the regular expression
'^([a-zA-Z0-9-]{1,63}\.){0,2}ddd\.ccc\.bbb\.aa$' is 'ccc.bbb.aa'.
The literal tail is extracted from the regular expression, has its encoded '.'
characters converted to normal ones, and then validated as a String by a new sequence of
validators.
This validator fails (and returns Validator.Action.DONE) if the
value does not possess a literal tail.
Otherwise, the validator applies the sequence of validators to the new value and returns the value of that sequence.
- Since:
- 0.10.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.metadata.validate.Validator
Validator.Action -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.shibboleth.metadata.validate.BaseAsValidator
doDestroy, doInitialize, getValidators, isConversionRequired, setConversionRequired, setValidators, validateMethods inherited from class net.shibboleth.metadata.validate.BaseValidator
addError, addErrorMessage, addErrorMessage, addErrorMessage, addStatus, addWarning, getMessage, makeComponentId, setMessageMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
Field Details
-
pattern
Regular expression to match and extract the literal tail.The component parts of this expression are:
- implicitly, anchored at the start of the string being matched
.*?matches non-greedily any text at the start of the regular expression, maximising the size of the later parts of the match\\\\.matches\.in the regular expression, which in turn matches a literal.in the scope- A group containing:
- At least one DNS label terminated by a literal '.'
- A final DNS label
\\$matches an end-string marker in the regular expression being matched- implicitly, anchored at the end of the string being matched
The matching of DNS labels is not exact. For example, labels starting or ending with hyphens are accepted as part of a literal tail. This will normally be detected by the nested validator sequence applied to the result.
Similarly, upper-case characters are permitted in the literal tail although these would not normally be permitted in scopes. Again, these characters are permitted so that a more specific error can be reported, rather than just a generic failure to convert.
-
-
Constructor Details
-
AsLiteralTailStringValidator
public AsLiteralTailStringValidator()
-
-
Method Details
-
convert
Description copied from class:BaseAsValidatorConvert from the old value type to the new.- Specified by:
convertin classBaseAsValidator<String,String> - Parameters:
regex- a value of the old type- Returns:
- a value of the new type
- Throws:
IllegalArgumentException- if a conversion can not be performed
-