• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IdentityProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IdentityProvider的典型用法代码示例。如果您正苦于以下问题:C# IdentityProvider类的具体用法?C# IdentityProvider怎么用?C# IdentityProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IdentityProvider类属于命名空间,在下文中一共展示了IdentityProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IdentityProvider_CreateAuthenticateRequest_Destination

        public void IdentityProvider_CreateAuthenticateRequest_Destination()
        {
            string idpUri = "http://idp.example.com/";
            
            var ip = new IdentityProvider(new Uri(idpUri));

            var r = ip.CreateAuthenticateRequest(null);

            r.ToXElement().Attribute("Destination").Should().NotBeNull()
                .And.Subject.Value.Should().Be(idpUri);
        }
开发者ID:dmarlow,项目名称:authservices,代码行数:11,代码来源:IdentityProviderTests.cs


示例2: IdentityProviderDictionary_Add

        public void IdentityProviderDictionary_Add()
        {
            var subject = new IdentityProviderDictionary();

            var entityId = new EntityId("http://idp.example.com");
            var idp = new IdentityProvider(entityId, StubFactory.CreateSPOptions());

            subject.Add(idp);

            subject[entityId].Should().BeSameAs(idp);
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:11,代码来源:IdentityProviderDictionaryTests.cs


示例3: Add

        /// <summary>
        /// Add an identity provider to the collection..
        /// </summary>
        /// <param name="idp">Identity provider to add.</param>
        public void Add(IdentityProvider idp)
        {
            if(idp == null)
            {
                throw new ArgumentNullException("idp");
            }

            lock(dictionary)
            {
                dictionary.Add(idp.EntityId, idp);
            }
        }
开发者ID:Raschmann,项目名称:authservices,代码行数:16,代码来源:IdentityProviderDictionary.cs


示例4: IdentityProvider_CreateAuthenticateRequest_DestinationInXml

        public void IdentityProvider_CreateAuthenticateRequest_DestinationInXml()
        {
            string idpUri = "http://idp.example.com/";

            var subject = new IdentityProvider(
                new EntityId(idpUri),
                Options.FromConfiguration.SPOptions)
                {
                    SingleSignOnServiceUrl = new Uri(idpUri)
                };

            var r = subject.CreateAuthenticateRequest(null, StubFactory.CreateAuthServicesUrls());

            r.ToXElement().Attribute("Destination").Should().NotBeNull()
                .And.Subject.Value.Should().Be(idpUri);
        }
开发者ID:Bidou44,项目名称:authservices,代码行数:16,代码来源:IdentityProviderTests.cs


示例5: IdentityProvider_Ctor_HandlesConfiguredCertificateWhenReadingMetadata

        public void IdentityProvider_Ctor_HandlesConfiguredCertificateWhenReadingMetadata()
        {
            var config = CreateConfig();
            config.LoadMetadata = true;
            config.EntityId = "http://localhost:13428/idpMetadataNoCertificate";

            var subject = new IdentityProvider(config, Options.FromConfiguration.SPOptions);

            // Check that metadata was read and overrides configured values.
            subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
            subject.SigningKeys.Single().ShouldBeEquivalentTo(
                new X509RawDataKeyIdentifierClause(SignedXmlHelper.TestCert));
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:13,代码来源:IdentityProviderTests.cs


示例6: IdentityProvider_Ctor_DisableOutboundLogoutRequest

        public void IdentityProvider_Ctor_DisableOutboundLogoutRequest()
        {
            var config = CreateConfig();
            config.DisableOutboundLogoutRequests = true;

            var subject = new IdentityProvider(config, StubFactory.CreateSPOptions());

            subject.DisableOutboundLogoutRequests.Should().BeTrue();
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:9,代码来源:IdentityProviderTests.cs


示例7: IdentityProvider_ReadMetadata_Nullcheck

        public void IdentityProvider_ReadMetadata_Nullcheck()
        {
            var subject = new IdentityProvider(
                new EntityId("http://idp.example.com"),
                StubFactory.CreateSPOptions());

            Action a = () => subject.ReadMetadata(null);

            a.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("metadata");
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:10,代码来源:IdentityProviderTests.cs


示例8: IdentityProvider_MetadataValidUntil_CalculatedFromCacheDuration

        public void IdentityProvider_MetadataValidUntil_CalculatedFromCacheDuration()
        {
            var config = CreateConfig();
            config.LoadMetadata = true;
            config.EntityId = "http://localhost:13428/idpMetadataNoCertificate";

            var subject = new IdentityProvider(config, Options.FromConfiguration.SPOptions);

            var expectedValidUntil = DateTime.UtcNow.AddMinutes(15);
            // Comparison on the second is more than enough if we're adding 15 minutes.
            subject.MetadataValidUntil.Should().BeCloseTo(expectedValidUntil, 1000);
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:12,代码来源:IdentityProviderTests.cs


示例9: IdentityProvider_MetadataValidUntil_NullOnConfigured

        public void IdentityProvider_MetadataValidUntil_NullOnConfigured()
        {
            string idpUri = "http://idp.example.com/";

            var subject = new IdentityProvider(
                new EntityId(idpUri),
                Options.FromConfiguration.SPOptions);

            subject.MetadataValidUntil.Should().NotHaveValue();
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:10,代码来源:IdentityProviderTests.cs


示例10: IdentityProvider_Ctor_UseMetadataLocationUrl

        public void IdentityProvider_Ctor_UseMetadataLocationUrl()
        {
            var config = CreateConfig();
            config.LoadMetadata = true;
            config.MetadataLocation = "http://localhost:13428/idpMetadataDifferentEntityId";
            config.EntityId = "some-idp";

            var subject = new IdentityProvider(config, Options.FromConfiguration.SPOptions);

            subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
            subject.SingleSignOnServiceUrl.Should().Be("http://idp.example.com/SsoService");
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:12,代码来源:IdentityProviderTests.cs


示例11: IdentityProvider_MetadataLocation_ThrowsWhenEntitiesDescriptorFoundAndNotAllowedByConfig

        public void IdentityProvider_MetadataLocation_ThrowsWhenEntitiesDescriptorFoundAndNotAllowedByConfig()
        {
            var spOptions = StubFactory.CreateSPOptions();
            spOptions.Compatibility.UnpackEntitiesDescriptorInIdentityProviderMetadata.Should().BeFalse();

            var subject = new IdentityProvider(
                new EntityId("http://idp.example.com"),
                spOptions);

            Action a = () => subject.MetadataLocation = "~/Metadata/SingleIdpInEntitiesDescriptor.xml";

            a.ShouldThrow<InvalidOperationException>();
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:13,代码来源:IdentityProviderTests.cs


示例12: TryGetValue

 /// <summary>
 /// Try to get the value of an idp with a given entity id.
 /// </summary>
 /// <param name="idpEntityId">Entity id to search for.</param>
 /// <param name="idp">The idp, if found.</param>
 /// <returns>True if an idp with the given entity id was found.</returns>
 public bool TryGetValue(EntityId idpEntityId, out IdentityProvider idp)
 {
     lock (dictionary)
     {
         return dictionary.TryGetValue(idpEntityId, out idp);
     }
 }
开发者ID:Raschmann,项目名称:authservices,代码行数:13,代码来源:IdentityProviderDictionary.cs


示例13: IdentityProvider_Ctor_LogoutBindingDefaultsToBinding

        public void IdentityProvider_Ctor_LogoutBindingDefaultsToBinding()
        {
            var config = CreateConfig();
            var subject = new IdentityProvider(config, StubFactory.CreateSPOptions());

            subject.Binding.Should().Be(Saml2BindingType.HttpPost);
            subject.SingleLogoutServiceBinding.Should().Be(Saml2BindingType.HttpPost);
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:8,代码来源:IdentityProviderTests.cs


示例14: Saml2Response_GetClaims_CorrectSignedResponseMessageSecondaryKey

        public void Saml2Response_GetClaims_CorrectSignedResponseMessageSecondaryKey()
        {
            var response =
            @"<?xml version=""1.0"" encoding=""UTF-8""?>
            <saml2p:Response xmlns:saml2p=""urn:oasis:names:tc:SAML:2.0:protocol""
            xmlns:saml2=""urn:oasis:names:tc:SAML:2.0:assertion""
            ID = """ + MethodBase.GetCurrentMethod().Name + @""" Version=""2.0"" IssueInstant=""2013-01-01T00:00:00Z"">
                <saml2:Issuer>https://twokeys.example.com</saml2:Issuer>
                <saml2p:Status>
                    <saml2p:StatusCode Value=""urn:oasis:names:tc:SAML:2.0:status:Success"" />
                </saml2p:Status>
                <saml2:Assertion xmlns:saml2=""urn:oasis:names:tc:SAML:2.0:assertion""
                Version=""2.0"" ID=""" + MethodBase.GetCurrentMethod().Name + @"_Assertion1""
                IssueInstant=""2013-09-25T00:00:00Z"">
                    <saml2:Issuer>https://twokeys.example.com</saml2:Issuer>
                    <saml2:Subject>
                        <saml2:NameID>SomeUser</saml2:NameID>
                        <saml2:SubjectConfirmation Method=""urn:oasis:names:tc:SAML:2.0:cm:bearer"" />
                    </saml2:Subject>
                    <saml2:Conditions NotOnOrAfter=""2100-01-01T00:00:00Z"" />
                </saml2:Assertion>
            </saml2p:Response>";

            var signedResponse = SignedXmlHelper.SignXml(response);

            var options = StubFactory.CreateOptions();

            var idp = new IdentityProvider(
                new EntityId("https://twokeys.example.com"), options.SPOptions)
            {
                AllowUnsolicitedAuthnResponse = true
            };

            idp.SigningKeys.AddConfiguredKey(SignedXmlHelper.TestKey2);
            idp.SigningKeys.AddConfiguredKey(SignedXmlHelper.TestKey);

            options.IdentityProviders.Add(idp);

            Action a = () => Saml2Response.Read(signedResponse).GetClaims(options);
            a.ShouldNotThrow();
        }
开发者ID:baguit,项目名称:authservices,代码行数:41,代码来源:Saml2ResponseTests.cs


示例15: send_requestAccountPasswordReset

 public void send_requestAccountPasswordReset(IdentityProvider provider, string identifier, string locale)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("requestAccountPasswordReset", TMessageType.Call, seqid_));
   requestAccountPasswordReset_args args = new requestAccountPasswordReset_args();
   args.Provider = provider;
   args.Identifier = identifier;
   args.Locale = locale;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
开发者ID:Banandana,项目名称:LineSharp,代码行数:16,代码来源:TalkService.cs


示例16: requestAccountPasswordReset

      public void requestAccountPasswordReset(IdentityProvider provider, string identifier, string locale)
      {
        #if !SILVERLIGHT
        send_requestAccountPasswordReset(provider, identifier, locale);
        recv_requestAccountPasswordReset();

        #else
        var asyncResult = Begin_requestAccountPasswordReset(null, null, provider, identifier, locale);
        End_requestAccountPasswordReset(asyncResult);

        #endif
      }
开发者ID:Banandana,项目名称:LineSharp,代码行数:12,代码来源:TalkService.cs


示例17: Begin_requestAccountPasswordReset

 public IAsyncResult Begin_requestAccountPasswordReset(AsyncCallback callback, object state, IdentityProvider provider, string identifier, string locale)
 {
   return send_requestAccountPasswordReset(callback, state, provider, identifier, locale);
 }
开发者ID:Banandana,项目名称:LineSharp,代码行数:4,代码来源:TalkService.cs


示例18: IdentityProvider_Ctor_PrefersRedirectBindingFromMetadata

        public void IdentityProvider_Ctor_PrefersRedirectBindingFromMetadata()
        {
            var config = CreateConfig();
            config.LoadMetadata = true;
            config.EntityId = "http://localhost:13428/idpMetadataWithMultipleBindings";

            var subject = new IdentityProvider(config, Options.FromConfiguration.SPOptions);

            subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
            subject.SingleSignOnServiceUrl.Should().Be("http://idp2Bindings.example.com/Redirect");
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:11,代码来源:IdentityProviderTests.cs


示例19: IdentityProvider_ConfigFromMetadata

        public void IdentityProvider_ConfigFromMetadata()
        {
            var entityId = new EntityId("http://localhost:13428/idpMetadata");
            var subject = new IdentityProvider(entityId, StubFactory.CreateSPOptions());

            // Add one that will be removed by loading.
            subject.ArtifactResolutionServiceUrls.Add(234, new Uri("http://example.com"));

            subject.LoadMetadata = true;

            subject.EntityId.Id.Should().Be(entityId.Id);
            subject.Binding.Should().Be(Saml2BindingType.HttpPost);
            subject.SingleSignOnServiceUrl.Should().Be(new Uri("http://localhost:13428/acs"));
            subject.SigningKeys.Single().ShouldBeEquivalentTo(new X509RawDataKeyIdentifierClause(SignedXmlHelper.TestCert));
            subject.ArtifactResolutionServiceUrls.Count.Should().Be(2);
            subject.ArtifactResolutionServiceUrls[0x1234].OriginalString
                .Should().Be("http://localhost:13428/ars");
            subject.ArtifactResolutionServiceUrls[117].OriginalString
                .Should().Be("http://localhost:13428/ars2");
            subject.SingleLogoutServiceUrl.OriginalString.Should().Be("http://localhost:13428/logout");
            subject.SingleLogoutServiceResponseUrl.OriginalString.Should().Be("http://localhost:13428/logoutResponse");
            subject.SingleLogoutServiceBinding.Should().Be(Saml2BindingType.HttpRedirect);
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:23,代码来源:IdentityProviderTests.cs


示例20: IdentityProvider_MetadataLoadedConfiguredFromCode

        public void IdentityProvider_MetadataLoadedConfiguredFromCode()
        {
            var spOptions = StubFactory.CreateSPOptions();

            spOptions.ServiceCertificates.Add(new ServiceCertificate()
            {
                Certificate = SignedXmlHelper.TestCert
            });

            var subject = new IdentityProvider(
                new EntityId("http://other.entityid.example.com"), spOptions)
            {
                MetadataLocation = "http://localhost:13428/idpMetadataOtherEntityId",
                AllowUnsolicitedAuthnResponse = true
            };

            subject.AllowUnsolicitedAuthnResponse.Should().BeTrue();
            subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
            subject.EntityId.Id.Should().Be("http://other.entityid.example.com");
            // If a metadatalocation is set, metadata loading is automatically enabled.
            subject.LoadMetadata.Should().BeTrue();
            subject.MetadataLocation.Should().Be("http://localhost:13428/idpMetadataOtherEntityId");
            subject.MetadataValidUntil.Should().BeCloseTo(
                DateTime.UtcNow.Add(MetadataRefreshScheduler.DefaultMetadataCacheDuration), precision: 100);
            subject.SingleSignOnServiceUrl.Should().Be("http://wrong.entityid.example.com/acs");
            subject.WantAuthnRequestsSigned.Should().Be(true, "WantAuthnRequestsSigned should have been loaded from metadata");

            Action a = () => subject.CreateAuthenticateRequest(StubFactory.CreateAuthServicesUrls());
            a.ShouldNotThrow();
        }
开发者ID:CDHDeveloper,项目名称:authservices,代码行数:30,代码来源:IdentityProviderTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IdentityReference类代码示例发布时间:2022-05-24
下一篇:
C# IdentityObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap