class SubjectTypeValidator implements AuthorizeRequestValidator {

    @Override
    public void validateRequest(OAuth2Request request) throws InvalidClientException,
            NotFoundException, ServerException {

        final OAuth2ProviderSettings settings = providerSettingsFactory.get(request);

        final Set<String> subjectTypesSupported = settings.getSupportedSubjectTypes();
        final String subjectType = clientRegistrationStore.get((String)
                request.getParameter(OAuth2Constants.Params.CLIENT_ID), request).getSubjectType().toLowerCase();

        for (String supported : subjectTypesSupported) {
            if (supported.toLowerCase().equals(subjectType)) {
                return;
            }
        }

        throw failureFactory.getException(request, "Server does not support this client's subject type.");

    }

    @Inject public  SubjectTypeValidator(OAuth2ProviderSettingsFactory providerSettingsFactory,
            OpenIdConnectClientRegistrationStore clientRegistrationStore, ClientAuthenticationFailureFactory failureFactory);

}