Class AsLiteralTailStringValidator

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.validate.BaseValidator
net.shibboleth.metadata.validate.BaseAsValidator<String,String>
net.shibboleth.metadata.validate.string.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

public class AsLiteralTailStringValidator extends BaseAsValidator<String,String> implements Validator<String>
A 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
    Modifier and Type
    Field
    Description
    private final Pattern
    Regular expression to match and extract the literal tail.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    convert(String regex)
    Convert from the old value type to the new.

    Methods inherited from class net.shibboleth.metadata.validate.BaseAsValidator

    doDestroy, doInitialize, getValidators, isConversionRequired, setConversionRequired, setValidators, validate

    Methods inherited from class net.shibboleth.metadata.validate.BaseValidator

    addError, addErrorMessage, addErrorMessage, addErrorMessage, addStatus, addWarning, getMessage, makeComponentId, setMessage

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

    setId

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

    ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitialized

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.shibboleth.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.IdentifiableComponent

    setId

    Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

    getId

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized

    Methods inherited from interface net.shibboleth.metadata.validate.Validator

    validate, validate
  • Field Details

    • pattern

      private final Pattern 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