/// <summary>
        /// Appends the SREG required attributes to the request URL constructed on challenge.
        /// </summary>
        public Task OnChallengeAsync(Microsoft.Owin.Security.AuthenticationResponseChallenge challenge, OpenIDAuthorizationEndpointInfo endpoint)
        {
            endpoint.Url += "&openid.ns.sreg=" + Uri.EscapeDataString(sregNamespace);

            var requiredClaims = string.Join(",", RequiredFields.Select(f => claimsMap[f]));
            endpoint.Url += "&openid.sreg.required=" + Uri.EscapeDataString(requiredClaims);

            if (OptionalFields.Any())
            {
                var optionalClaims = string.Join(",", OptionalFields.Select(f => claimsMap[f]));
                endpoint.Url += "&openid.sreg.optional=" + Uri.EscapeDataString(optionalClaims);
            }

            if (!string.IsNullOrEmpty(PolicyUrl))
            {
                endpoint.Url += "&openid.sreg.policy_url=" + Uri.EscapeDataString(PolicyUrl);
            }

            return Task.FromResult(0);
        }
        /// <summary>
        /// Appends the SREG required attributes to the request URL constructed on challenge.
        /// </summary>
        public Task OnChallengeAsync(Microsoft.Owin.Security.AuthenticationResponseChallenge challenge, OpenIDAuthorizationEndpointInfo endpoint)
        {
            endpoint.Url += "&openid.ns.sreg=" + Uri.EscapeDataString(sregNamespace);

            var requiredClaims = string.Join(",", RequiredFields.Select(f => claimsMap[f]));

            endpoint.Url += "&openid.sreg.required=" + Uri.EscapeDataString(requiredClaims);

            if (OptionalFields.Any())
            {
                var optionalClaims = string.Join(",", OptionalFields.Select(f => claimsMap[f]));
                endpoint.Url += "&openid.sreg.optional=" + Uri.EscapeDataString(optionalClaims);
            }

            if (!string.IsNullOrEmpty(PolicyUrl))
            {
                endpoint.Url += "&openid.sreg.policy_url=" + Uri.EscapeDataString(PolicyUrl);
            }

            return(Task.FromResult(0));
        }