Class BasicHttpServletRequestParametersValidator

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.servlet.impl.BasicHttpServletRequestParametersValidator
All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, HttpServletRequestValidator

public class BasicHttpServletRequestParametersValidator extends AbstractInitializableComponent implements HttpServletRequestValidator
Component that validates HTTP request parameters for required presence, uniqueness and mutual exclusivity.
  • Field Details

    • log

      @Nonnull private org.slf4j.Logger log
      Logger.
    • enforceAllowedParameters

      private boolean enforceAllowedParameters
      Flag indicating whether to enforce the allowed parameters.
    • allowedParameters

      @Nonnull private Set<String> allowedParameters
      Allowed parameters.
    • requiredParameters

      @Nonnull private Set<String> requiredParameters
      Required parameters.
    • uniqueParameters

      @Nonnull private Set<String> uniqueParameters
      Unique parameters.
    • mutuallyExclusiveParameters

      @Nonnull private Set<Set<String>> mutuallyExclusiveParameters
      Mutually exclusive parameters.
  • Constructor Details

    • BasicHttpServletRequestParametersValidator

      public BasicHttpServletRequestParametersValidator()
  • Method Details

    • isEnforceAllowedParameters

      public boolean isEnforceAllowedParameters()
      Get flag indicating whether to enforce the allowed parameters.

      Defaults to false.

      Returns:
      flag indicating enforcement of allowed parameters
    • setEnforceAllowedParameters

      public void setEnforceAllowedParameters(boolean flag)
      Set flag indicating whether to enforce the allowed parameters.

      Defaults to false.

      Parameters:
      flag - indicating enforcement of allowed parameters
    • getAllowedParameters

      @Nonnull @Unmodifiable @NotLive public Set<String> getAllowedParameters()
      Get the allowed parameters.

      When enforced, a request parameter not in the allowed set will be considered invalid.

      Returns:
      the allowed parameters
    • setAllowedParameters

      public void setAllowedParameters(@Nullable Set<String> params)
      Set the allowed parameters.

      When enforced, a request parameter not in the allowed set will be considered invalid.

      Parameters:
      params - the allowed parameters
    • getRequiredParameters

      @Nonnull @Unmodifiable @NotLive public Set<String> getRequiredParameters()
      Get the required parameters.

      A required parameter must be present in the request.

      Returns:
      the required parameters
    • setRequiredParameters

      public void setRequiredParameters(@Nullable Set<String> params)
      Set the required parameters.

      A required parameter must be present in the request.

      Parameters:
      params - the required parameters
    • getUniqueParameters

      @Nonnull @Unmodifiable @NotLive public Set<String> getUniqueParameters()
      Get the unique parameters.

      A unique parameter must have at most 1 value.

      Returns:
      the unique parameters
    • setUniqueParameters

      public void setUniqueParameters(@Nullable Set<String> params)
      Set the unique parameters.

      A unique parameter must have at most 1 value.

      Parameters:
      params - the unique parameters
    • getMutuallyExclusiveParameters

      @Nonnull @Unmodifiable @NotLive public Set<Set<String>> getMutuallyExclusiveParameters()
      Get the mutually exclusive parameters.

      A request may not contain more then 1 parameter from an exclusivity set (the "inner" set(s) configured). Multiple exclusivity sets may be specified.

      Returns:
      the mutually exclusive parameters
    • setMutuallyExclusiveParameters

      public void setMutuallyExclusiveParameters(@Nullable Set<Set<String>> params)
      Set the mutually exclusive parameters.

      A request may not contain more then 1 parameter from an exclusivity set (the "inner" set(s) configured). Multiple exclusivity sets may be specified.

      Parameters:
      params - the mutually exclusive parameters
    • validate

      public void validate(@Nonnull HttpServletRequest request) throws ServletException
      Validate the request.
      Specified by:
      validate in interface HttpServletRequestValidator
      Parameters:
      request - the request to validate
      Throws:
      ServletException - if the request is determined to be invalid