public void IdentityProviderCollection_RegisterIdentityProvider_NullCheck()
        {
            var subject = new IdentityProviderCollection();

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

            a.ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("options");
        }
        public void IdentityProviderCollection_RegisterIdentityProvider_NullCheck()
        {
            var subject = new IdentityProviderCollection();

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

            a.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("options");
        }
 private IdentityProviders ToIdentityProviders(IEnumerable<IdentityProvider> providers, IdentityProviderCollection config)
 {
     var idps = new IdentityProviders(providers)
     {
         Encodings = config.Encodings,
         SelectionUrl = config.SelectionUrl
     };
     idps.AddByMetadataDirectory(config.MetadataLocation);
     return idps;
 }
Exemple #4
0
        public void CanLoadMetadataFileWithMultipleIdpDescriptors()
        {
            var collection = new IdentityProviderCollection
            {
                MetadataLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, "Protocol", "MetadataDocs", "multiple-idps")
            };

            collection.Refresh();

            Assert.That(collection.Count == 2);
        }
Exemple #5
0
        /// <summary>
        /// Validates the <see cref="IdentityProviderCollection"/>.
        /// </summary>
        /// <param name="identityProviders">The <see cref="IdentityProviderCollection"/>.</param>
        private void ValidateIdentityProviders(IdentityProviderCollection identityProviders)
        {
            if (identityProviders == null)
            {
                throw new Saml20ConfigurationException("Configuration IdentityProviders cannot be null");
            }

            foreach (var idp in identityProviders)
            {
                _identityProviderValidator.ValidateIdentityProvider(idp);
            }
        }
Exemple #6
0
        private IdentityProviders ToIdentityProviders(IEnumerable <IdentityProvider> providers, IdentityProviderCollection config)
        {
            var idps = new IdentityProviders(providers)
            {
                Encodings    = config.Encodings,
                SelectionUrl = config.SelectionUrl
            };

            idps.AddByMetadataDirectory(config.MetadataLocation);
            return(idps);
        }
 /// <summary>
 /// Invokes the IDP selection event handler.
 /// </summary>
 /// <param name="endpoints">The endpoints.</param>
 /// <returns>The <see cref="IdentityProviderElement"/>.</returns>
 internal static IdentityProviderElement InvokeIDPSelectionEventHandler(IdentityProviderCollection endpoints)
 {
     return IdpSelectionEvent != null ? IdpSelectionEvent(endpoints) : null;
 }
 /// <summary>
 /// Invokes the IDP selection event handler.
 /// </summary>
 /// <param name="endpoints">The endpoints.</param>
 /// <returns>The <see cref="IdentityProviderElement"/>.</returns>
 internal static IdentityProviderElement InvokeIDPSelectionEventHandler(IdentityProviderCollection endpoints)
 {
     return(IdpSelectionEvent != null?IdpSelectionEvent(endpoints) : null);
 }
 private IdentityProviders ToIdentityProviders(IEnumerable <IdentityProvider> providers, IdentityProviderCollection config)
 {
     return(new IdentityProviders(providers)
     {
         Encodings = config.Encodings,
         MetadataLocation = config.MetadataLocation,
         SelectionUrl = config.SelectionUrl
     });
 }