示例#1
0
        public virtual IEnumerable<HrdIdentityProvider> GetHrdResponse(HrdRequest request)
        {
            WebClient client = new WebClient();
            client.Encoding = Encoding.UTF8;

            string response = client.DownloadString(request.GetUrlWithQueryString());

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Deserialize<List<HrdIdentityProvider>>(response);
        }
        public PartialViewResult IdentityProvidersWithServerSideCode()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;
            HrdRequest request = new HrdRequest(fam.Issuer, fam.Realm, context: Request.Url.AbsoluteUri);

            IEnumerable<HrdIdentityProvider> hrdIdentityProviders = _hrdClient.GetHrdResponse(request);

            return PartialView("_IdentityProvidersWithServerSideCode", hrdIdentityProviders);
        }
        public PartialViewResult IdentityProvidersWithClientSideCode()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;
            // The code below doesn't work on the emulator because the port number in Request.Url is incorrect
            // HrdRequest request = new HrdRequest(fam.Issuer, fam.Realm, context: Request.Url.AbsoluteUri);
            // This is a hack workaround because the correct URI is actually in the Realm:
            HrdRequest request = new HrdRequest(fam.Issuer, fam.Realm, context:fam.Realm);

            return PartialView("_IdentityProvidersWithClientSideCode", request);
        }