当前位置: 首页>>代码示例>>C#>>正文


C# UriIdentifier.Discover方法代码示例

本文整理汇总了C#中DotNetOpenAuth.OpenId.UriIdentifier.Discover方法的典型用法代码示例。如果您正苦于以下问题:C# UriIdentifier.Discover方法的具体用法?C# UriIdentifier.Discover怎么用?C# UriIdentifier.Discover使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetOpenAuth.OpenId.UriIdentifier的用法示例。


在下文中一共展示了UriIdentifier.Discover方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DiscoveryRequiresSslIgnoresInsecureEndpointsInXrds

 public void DiscoveryRequiresSslIgnoresInsecureEndpointsInXrds()
 {
     var insecureEndpoint = GetServiceEndpoint(0, ProtocolVersion.V20, 10, false);
     var secureEndpoint = GetServiceEndpoint(1, ProtocolVersion.V20, 20, true);
     UriIdentifier secureClaimedId = new UriIdentifier(VanityUriSsl, true);
     this.MockResponder.RegisterMockXrdsResponse(secureClaimedId, new ServiceEndpoint[] { insecureEndpoint, secureEndpoint });
     Assert.AreEqual(secureEndpoint.ProviderLocalIdentifier, secureClaimedId.Discover(this.RequestHandler).Single().ProviderLocalIdentifier);
 }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:8,代码来源:UriIdentifierTests.cs

示例2: DiscoveryWithRedirects

        public void DiscoveryWithRedirects()
        {
            Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, false);

            // Add a couple of chained redirect pages that lead to the claimedId.
            Uri userSuppliedUri = new Uri("https://localhost/someSecurePage");
            Uri insecureMidpointUri = new Uri("http://localhost/insecureStop");
            this.MockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
            this.MockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));

            // don't require secure SSL discovery for this test.
            Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, false);
            Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:14,代码来源:UriIdentifierTests.cs

示例3: DiscoveryRequireSslWithInsecureXrdsInSecureHttpHeader

        public void DiscoveryRequireSslWithInsecureXrdsInSecureHttpHeader()
        {
            var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);

            string html = "<html><head></head><body></body></html>";
            WebHeaderCollection headers = new WebHeaderCollection {
                { "X-XRDS-Location", insecureXrdsSource }
            };
            this.MockResponder.RegisterMockResponse(VanityUriSsl, VanityUriSsl, "text/html", headers, html);

            Identifier userSuppliedIdentifier = new UriIdentifier(VanityUriSsl, true);
            Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:13,代码来源:UriIdentifierTests.cs

示例4: DiscoveryRequireSslWithInsecureXrdsInSecureHtmlHead

        public void DiscoveryRequireSslWithInsecureXrdsInSecureHtmlHead()
        {
            var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);
            Uri secureClaimedUri = new Uri("https://localhost/secureId");

            string html = string.Format("<html><head><meta http-equiv='X-XRDS-Location' content='{0}'/></head><body></body></html>", insecureXrdsSource);
            this.MockResponder.RegisterMockResponse(secureClaimedUri, "text/html", html);

            Identifier userSuppliedIdentifier = new UriIdentifier(secureClaimedUri, true);
            Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:11,代码来源:UriIdentifierTests.cs

示例5: DiscoveryRequireSslWithInsecureXrdsButSecureLinkTags

        public void DiscoveryRequireSslWithInsecureXrdsButSecureLinkTags()
        {
            var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);
            string html = string.Format(
                @"
            <html><head>
            <meta http-equiv='X-XRDS-Location' content='{0}'/> <!-- this one will be insecure and ignored -->
            <link rel='openid2.provider' href='{1}' />
            <link rel='openid2.local_id' href='{2}' />
            </head><body></body></html>",
                HttpUtility.HtmlEncode(insecureXrdsSource),
                HttpUtility.HtmlEncode(OPUriSsl.AbsoluteUri),
                HttpUtility.HtmlEncode(OPLocalIdentifiersSsl[1].AbsoluteUri));
            this.MockResponder.RegisterMockResponse(VanityUriSsl, "text/html", html);

            Identifier userSuppliedIdentifier = new UriIdentifier(VanityUriSsl, true);

            // We verify that the XRDS was ignored and the LINK tags were used
            // because the XRDS OP-LocalIdentifier uses different local identifiers.
            Assert.AreEqual(OPLocalIdentifiersSsl[1], userSuppliedIdentifier.Discover(this.RequestHandler).Single().ProviderLocalIdentifier);
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:21,代码来源:UriIdentifierTests.cs

示例6: DiscoverRequireSslWithSecureRedirects

        public void DiscoverRequireSslWithSecureRedirects()
        {
            Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, true);

            // Add a couple of chained redirect pages that lead to the claimedId.
            // All redirects should be secure.
            Uri userSuppliedUri = new Uri("https://localhost/someSecurePage");
            Uri secureMidpointUri = new Uri("https://localhost/secureStop");
            this.MockResponder.RegisterMockRedirect(userSuppliedUri, secureMidpointUri);
            this.MockResponder.RegisterMockRedirect(secureMidpointUri, new Uri(claimedId.ToString()));

            Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, true);
            Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:14,代码来源:UriIdentifierTests.cs

示例7: DiscoverRequireSslWithInsecureRedirect

        public void DiscoverRequireSslWithInsecureRedirect()
        {
            Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, true);

            // Add a couple of chained redirect pages that lead to the claimedId.
            // Include an insecure HTTP jump in those redirects to verify that
            // the ultimate endpoint is never found as a result of high security profile.
            Uri userSuppliedUri = new Uri("https://localhost/someSecurePage");
            Uri insecureMidpointUri = new Uri("http://localhost/insecureStop");
            this.MockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
            this.MockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));

            Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, true);
            userSuppliedIdentifier.Discover(this.RequestHandler);
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:15,代码来源:UriIdentifierTests.cs


注:本文中的DotNetOpenAuth.OpenId.UriIdentifier.Discover方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。