class AuthorizeRequestValidatorImpl implements AuthorizeRequestValidator {

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

        Reject.ifTrue(isEmpty(request.<String>getParameter(CLIENT_ID)), "Missing parameter, 'client_id'");
        Reject.ifTrue(isEmpty(request.<String>getParameter(RESPONSE_TYPE)), "Missing parameter, 'response_type'");

        final ClientRegistration clientRegistration = clientRegistrationStore.get(request.<String>getParameter(CLIENT_ID),
                request);

        if (request.getEndpointType() != EndpointType.END_USER_VERIFICATION_URI) {
            if (clientRegistration == null) {
                throw new InvalidRequestException("Failed to validate the client ID");
            }

            Set<URI> redirectUris = clientRegistration.getRedirectUris();

            if (isEmpty(redirectUris)) {
                throw new InvalidRequestException("Failed to resolve the redirect URI, no URI's registered");
            }

            String redirectUri = request.<String>getParameter(REDIRECT_URI);
            if (isEmpty(redirectUri) && redirectUris.size() == 1) {
                redirectUri = redirectUris.iterator().next().toString();
            }
            if (isEmpty(redirectUri)) {
                throw new InvalidRequestException("Failed to resolve the redirect URI");
            }

            redirectUriValidator.validate(clientRegistration, redirectUri);
            request.setValidRedirectUri(redirectUri);
        }

        responseTypeValidator.validate(clientRegistration,
                splitResponseType(request.<String>getParameter(RESPONSE_TYPE)), providerSettingsFactory.get(request));
    }

    @Inject public  AuthorizeRequestValidatorImpl(ClientRegistrationStore clientRegistrationStore,
            RedirectUriValidator redirectUriValidator, OAuth2ProviderSettingsFactory providerSettingsFactory,
            ResponseTypeValidator responseTypeValidator);

}