<commit_before>using IdentityServer4.Configuration;
using IdentityServer4.Models;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace IdentityServer4.Validation
{
    /// <summary>
    /// Default client configuration validator
    /// </summary>
    /// <seealso cref="IdentityServer4.Validation.IClientConfigurationValidator" />
    public class DefaultClientConfigurationValidator : IClientConfigurationValidator
    {
        private readonly IdentityServerOptions _options;

        // todo: default ctor for backwards compat; remove in 3.0

        /// <summary>
        /// Constructor for DefaultClientConfigurationValidator
        /// </summary>
        public DefaultClientConfigurationValidator()
        {
        }

        /// <summary>
        /// Constructor for DefaultClientConfigurationValidator
        /// </summary>
        public DefaultClientConfigurationValidator(IdentityServerOptions options)
        {
            _options = options;
        }

        /// <summary>
        /// Determines whether the configuration of a client is valid.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public async Task ValidateAsync(ClientConfigurationValidationContext context)
        {
            await ValidateGrantTypesAsync(context);
            if (context.IsValid == false) return;

            await ValidateLifetimesAsync(context);
            if (context.IsValid == false) return;

            await ValidateRedirectUriAsync(context);
            if (context.IsValid == false) return;

            await ValidateUriSchemesAsync(context);
            if (context.IsValid == false) return;

            await ValidateSecretsAsync(context);
            if (context.IsValid == false) return;

            await ValidatePropertiesAsync(context);
            if (context.IsValid == false) return;
        }

        /// <summary>
        /// Validates grant type related configuration settings.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        protected virtual Task ValidateGrantTypesAsync(ClientConfigurationValidationContext context)
        {
            if (!context.Client.AllowedGrantTypes.Any())
            {
                context.SetError("no allowed grant type specified");
            }
<commit_msg>Added OIDC check to client config handler (#3024)<commit_after>using IdentityServer4.Configuration;
using IdentityServer4.Models;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace IdentityServer4.Validation
{
    /// <summary>
    /// Default client configuration validator
    /// </summary>
    /// <seealso cref="IdentityServer4.Validation.IClientConfigurationValidator" />
    public class DefaultClientConfigurationValidator : IClientConfigurationValidator
    {
        private readonly IdentityServerOptions _options;

        // todo: default ctor for backwards compat; remove in 3.0

        /// <summary>
        /// Constructor for DefaultClientConfigurationValidator
        /// </summary>
        public DefaultClientConfigurationValidator()
        {
        }

        /// <summary>
        /// Constructor for DefaultClientConfigurationValidator
        /// </summary>
        public DefaultClientConfigurationValidator(IdentityServerOptions options)
        {
            _options = options;
        }

        /// <summary>
        /// Determines whether the configuration of a client is valid.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public async Task ValidateAsync(ClientConfigurationValidationContext context)
        {
            if (context.Client.ProtocolType == IdentityServerConstants.ProtocolTypes.OpenIdConnect)
            {
                await ValidateGrantTypesAsync(context);
                if (context.IsValid == false) return;

                await ValidateLifetimesAsync(context);
                if (context.IsValid == false) return;

                await ValidateRedirectUriAsync(context);
                if (context.IsValid == false) return;

                await ValidateUriSchemesAsync(context);
                if (context.IsValid == false) return;

                await ValidateSecretsAsync(context);
                if (context.IsValid == false) return;

                await ValidatePropertiesAsync(context);
                if (context.IsValid == false) return;
            }
        }

        /// <summary>
        /// Validates grant type related configuration settings.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        protected virtual Task ValidateGrantTypesAsync(ClientConfigurationValidationContext context)
        {
            if (!context.Client.AllowedGrantTypes.Any())
            {
                context.SetError("no allowed grant type specified");
            }

{'fraction_non_alphanumeric': 0.0958, 'fraction_numerical': 0.0032, 'mean_word_length': 2.1413316582914574, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1888575', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1119, 'n_words': 278}