public Task ValidateAsync(CustomTokenRequestValidationContext context)
        {
            var hasClientCredentials = context.Result.ValidatedRequest.Client.AllowedGrantTypes.Contains("client_credentials");

            if (hasClientCredentials && !_ipAddressValidator.IsIpAddressInternal())
            {
                context.Result.IsError = true;
                context.Result.Error   = OidcConstants.AuthorizeErrors.UnauthorizedClient;
            }
            return(Task.CompletedTask);
        }
        public async Task <IActionResult> Login(string returnUrl = "/")
        {
            var context = await _interaction.GetAuthorizationContextAsync(returnUrl);

            if (context != null)
            {
                var client = await _clientStore.FindClientByIdAsync(context.ClientId);

                if (!client.EnableLocalLogin)
                {
                    return(await ExternalLogin("EDevlet", returnUrl));
                }
            }
            if (!_ipAddressValidator.IsIpAddressInternal())
            {
                return(await ExternalLogin("EDevlet", returnUrl));
            }
            return(View(new LoginModel()
            {
                ReturnUrl = System.Net.WebUtility.UrlEncode(returnUrl),
                IsLocalContext = context == null
            }));
        }