protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            string usernameParameter = Request.Query["username"];

            if (!string.IsNullOrEmpty(usernameParameter))
            {
                var validateCredentialsContext = new ValidateCredentialsContext(Context, Scheme, Options)
                {
                    Username = usernameParameter
                };

                await Options.Events.ValidateUsername(validateCredentialsContext);

                if (validateCredentialsContext.Result != null)
                {
                    var ticket = new AuthenticationTicket(validateCredentialsContext.Principal, Scheme.Name);
                    return(AuthenticateResult.Success(ticket));
                }
            }

            return(AuthenticateResult.NoResult());
        }
 public virtual Task ValidateUsername(ValidateCredentialsContext context) => OnValidateUsername(context);