Package net.shibboleth.shared.servlet.impl

# 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.

Since:
  9.1.4

## Field Summary

Fields
Modifier and Type
Field
Description
`private Set<String>`
`allowedParameters`
Allowed parameters.
`private boolean`
`enforceAllowedParameters`
Flag indicating whether to enforce the allowed parameters.
`private org.slf4j.Logger`
`log`
Logger.
`private Set<Set<String>>`
`mutuallyExclusiveParameters`
Mutually exclusive parameters.
`private Set<String>`
`requiredParameters`
Required parameters.
`private Set<String>`
`uniqueParameters`
Unique parameters.

## Constructor Summary

Constructors
Constructor
Description
`BasicHttpServletRequestParametersValidator()`

## Method Summary

Modifier and Type
Method
Description
`Set<String>`
`getAllowedParameters()`
Get the allowed parameters.
`Set<Set<String>>`
`getMutuallyExclusiveParameters()`
Get the mutually exclusive parameters.
`Set<String>`
`getRequiredParameters()`
Get the required parameters.
`Set<String>`
`getUniqueParameters()`
Get the unique parameters.
`boolean`
`isEnforceAllowedParameters()`
Get flag indicating whether to enforce the allowed parameters.
`void`
`setAllowedParameters(Set<String> params)`
Set the allowed parameters.
`void`
`setEnforceAllowedParameters(boolean flag)`
Set flag indicating whether to enforce the allowed parameters.
`void`
`setMutuallyExclusiveParameters(Set<Set<String>> params)`
Set the mutually exclusive parameters.
`void`
`setRequiredParameters(Set<String> params)`
Set the required parameters.
`void`
`setUniqueParameters(Set<String> params)`
Set the unique parameters.
`void`
`validate(HttpServletRequest request)`
Validate the request.

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

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

## 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