private async Task <HandleRequestResult> ValidateAuthenticationResponse(ResponseType response, AuthnRequestType request, AuthenticationProperties properties, string idPName)
        {
            if (response == null)
            {
                if (Options.SkipUnrecognizedRequests)
                {
                    return(HandleRequestResult.SkipHandler());
                }

                return(HandleRequestResult.Fail("No message."));
            }

            if (properties == null && !Options.AllowUnsolicitedLogins)
            {
                return(HandleRequestResult.Fail("Unsolicited logins are not allowed."));
            }

            var idp = Options.IdentityProviders.FirstOrDefault(x => x.Name == idPName);

            var metadataIdp = await DownloadMetadataIDP(idp.OrganizationUrlMetadata);

            response.ValidateAuthnResponse(request, metadataIdp);
            return(null);
        }