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


C# IdentityProvider类代码示例

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


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


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