public bool RequestAndCheck()
        {
            bool ret = false;

            HttpContext context = WebApplication.CurrentContext;
            HttpRequest request = context.Request;

            string invalidateHandle = request.UriArgs["openid.invalidate_handle"];

            if (invalidateHandle == null)
            {
                var discover = new DiscoverRequest();
                discover.Request(context.OverlayNode, DiscoverRequest.Google_Discover_OpenID_Endpoint);

                var auth = new WebAuth();

                var ub = new UriBuilder(context.Request.Uri);

                lock (sync)
                {
                    if (!CacheAssociations.ContainsKey(auth.ToStringHandle()))
                    {
                        CacheAssociations.Add(auth.ToStringHandle(),
                                              new KeyAssociation(auth.ToStringHandle()));
                    }
                }

                var realm   = ub.Uri.ToString();
                var authReq = new AuthenticationRequest(discover, realm,
                                                        auth.ToStringHandle(), realm, AppNode);

                context.Reply.RedirectTo(authReq.UrlRedirectTo());
            }
            else
            {
                lock (sync)
                {
                    ret = CacheAssociations.ContainsKey(invalidateHandle);
                    if (ret)
                    {
                        CacheAssociations.Remove(invalidateHandle);
                    }
                }
            }

            return(ret);
        }
        public AuthenticationRequest(DiscoverRequest discover,
                                     string returnTo, string sessionId, string realm, Node localNode)
        {
            XrdsDocument = discover.XrdsDocument;

            Request     = new HttpRequest(localNode);
            Request.Url = discover.ProviderEndpoint.ToString();
            //-- Request.Url = "https://www.google.com/accounts/o8/id";

            Mode           = "checkid_setup";
            Ns             = "http://specs.openid.net/auth/2.0";
            AssocHandle    = sessionId;
            ClaimedId      = "http://specs.openid.net/auth/2.0/identifier_select";
            Identity       = "http://specs.openid.net/auth/2.0/identifier_select";
            ReturnTo       = returnTo;
            Realm          = realm;
            UiNs           = "http://specs.openid.net/extensions/ui/1.0";
            UiMode         = "x-has-session";
            UiIcon         = true;
            AxNs           = "http://openid.net/srv/ax/1.0";
            AxMode         = "fetch_request";
            AxTypeEmail    = "http://axschema.org/contact/email";
            AxTypeLanguage = "http://axschema.org/pref/language";
            AxRequired     = "email,language";

            /*
             * PapeNs = "http://specs.openid.net/extensions/pape/1.0";
             * PapeMaxAuthAge = "50";
             * UiNs = "http://specs.openid.net/extensions/ui/1.0";
             * UiMode = "x-has-session";
             * UiIcon = true;
             * AxNs = "http://openid.net/srv/ax/1.0";
             * AxMode = "fetch_request";
             * AxRequired = "email";
             * AxTypeCountry = "http://axschema.org/contact/country/home";
             * AxTypeEmail = "http://axschema.org/contact/email";
             * AxTypeFirstName = "http://axschema.org/namePerson/first";
             * AxTypeLanguage = "http://axschema.org/pref/language";
             * AxTypeLastName = "http://axschema.org/namePerson/last";
             */
        }