class DuplicateRequestParameterValidator implements AuthorizeRequestValidator {

    public void validateRequest(OAuth2Request request) throws InvalidClientException, InvalidRequestException,
            RedirectUriMismatchException, UnsupportedResponseTypeException, ServerException, BadRequestException,
            InvalidScopeException, NotFoundException, DuplicateRequestParameterException {

        Set<String> parameterNames = request.getParameterNames();
        for (String parameterName : parameterNames) {
            if (request.getParameterCount(parameterName) > 1) {
                throw new DuplicateRequestParameterException("Invalid Request, duplicate request parameter found : " + parameterName);
            }
        }
    }

}