public void Setup()
        {
            SecuritySettings data = new SecuritySettings();

            data.DefaultAuthenticationProviderName = "provider2";

            CustomAuthenticationProviderData provider1Data =
                new CustomAuthenticationProviderData();

            provider1Data.Name     = "provider1";
            provider1Data.TypeName = typeof(MockAuthenticationProvider).AssemblyQualifiedName;
            data.AuthenticationProviders.Add(provider1Data);

            CustomAuthenticationProviderData provider2Data =
                new CustomAuthenticationProviderData();

            provider2Data.Name     = "provider2";
            provider2Data.TypeName = typeof(Mock2AuthenticationProvider).AssemblyQualifiedName;
            // provider2Data.Default = true;
            data.AuthenticationProviders.Add(provider2Data);

            ConfigurationDictionary dictionary = new ConfigurationDictionary();

            dictionary[SecuritySettings.SectionName] = data;
            ConfigurationContext context = ConfigurationManager.CreateContext(dictionary);

            this.factory = new AuthenticationProviderFactory(context);
        }
 public void AttributesTest()
 {
     CustomAuthenticationProviderData data = new CustomAuthenticationProviderData();
     data.Extensions.Add(new NameValueItem("key", "value"));
     string value = data.Extensions["key"];
     Assert.AreEqual("value", value);
     Assert.AreEqual(1, data.Extensions.Count);
 }
        public void AttributesTest()
        {
            CustomAuthenticationProviderData data = new CustomAuthenticationProviderData();

            data.Extensions.Add(new NameValueItem("key", "value"));
            string value = data.Extensions["key"];

            Assert.AreEqual("value", value);
            Assert.AreEqual(1, data.Extensions.Count);
        }
 public void HydrateTest()
 {
     AuthenticationProviderDataCollection dataCollection = new AuthenticationProviderDataCollection();
     CustomAuthenticationProviderData providerData = new CustomAuthenticationProviderData();
     providerData.Name = "provider1";
     providerData.TypeName = typeof(MockAuthenticationProvider).AssemblyQualifiedName;
     dataCollection.Add(providerData);
     AuthenticationProviderCollectionNode node = new AuthenticationProviderCollectionNode(dataCollection);
     CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
     Assert.AreEqual(1, node.AuthenticationProviderDataCollection.Count);
 }
Exemple #5
0
        public void HydrateTest()
        {
            AuthenticationProviderDataCollection dataCollection = new AuthenticationProviderDataCollection();
            CustomAuthenticationProviderData     providerData   = new CustomAuthenticationProviderData();

            providerData.Name     = "provider1";
            providerData.TypeName = typeof(MockAuthenticationProvider).AssemblyQualifiedName;
            dataCollection.Add(providerData);
            AuthenticationProviderCollectionNode node = new AuthenticationProviderCollectionNode(dataCollection);

            CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
            Assert.AreEqual(1, node.AuthenticationProviderDataCollection.Count);
        }
        public void AuthenticationCollection()
        {
            SecuritySettings settings = new SecuritySettings();

            AuthenticationProviderDataCollection authProviders = new AuthenticationProviderDataCollection();
            CustomAuthenticationProviderData data = new CustomAuthenticationProviderData();
            data.Name = "name";
            authProviders.Add(data);
            foreach (AuthenticationProviderData authenticationProviderData in authProviders)
            {
                settings.AuthenticationProviders.Add(authenticationProviderData);
            }
            Assert.AreEqual(settings.AuthenticationProviders.Count, 1);
        }
Exemple #7
0
        public void AuthenticationCollection()
        {
            SecuritySettings settings = new SecuritySettings();

            AuthenticationProviderDataCollection authProviders = new AuthenticationProviderDataCollection();
            CustomAuthenticationProviderData     data          = new CustomAuthenticationProviderData();

            data.Name = "name";
            authProviders.Add(data);
            foreach (AuthenticationProviderData authenticationProviderData in authProviders)
            {
                settings.AuthenticationProviders.Add(authenticationProviderData);
            }
            Assert.AreEqual(settings.AuthenticationProviders.Count, 1);
        }
Exemple #8
0
        public void GetAuthenticationDataTest()
        {
            AuthenticationProviderCollectionNode node = new AuthenticationProviderCollectionNode();

            CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
            CustomAuthenticationProviderNode providerNode = new CustomAuthenticationProviderNode();

            node.Nodes.Add(providerNode);
            providerNode.Name     = "provider1";
            providerNode.TypeName = typeof(MockAuthenticationProvider).AssemblyQualifiedName;
            AuthenticationProviderDataCollection providers = node.AuthenticationProviderDataCollection;

            Assert.IsNotNull(providers);
            Assert.AreEqual(1, providers.Count);
            AuthenticationProviderData data = providers["provider1"];

            Assert.IsNotNull(data);
            CustomAuthenticationProviderData customData = data as CustomAuthenticationProviderData;

            Assert.IsNotNull(customData);
            Assert.AreEqual(typeof(MockAuthenticationProvider).AssemblyQualifiedName, customData.TypeName);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomAuthenticationProviderNode"/>
 /// class from existing configuration data.
 /// </summary>
 /// <param name="customAuthenticationProviderData">Configuration data for a generic authentication provider</param>
 public CustomAuthenticationProviderNode(CustomAuthenticationProviderData customAuthenticationProviderData)
     : base(customAuthenticationProviderData)
 {
     this.customAuthenticationProviderData = customAuthenticationProviderData;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomAuthenticationProviderNode"/>
 /// class from existing configuration data.
 /// </summary>
 /// <param name="customAuthenticationProviderData">Configuration data for a generic authentication provider</param>
 public CustomAuthenticationProviderNode(CustomAuthenticationProviderData customAuthenticationProviderData) : base(customAuthenticationProviderData)
 {
     this.customAuthenticationProviderData = customAuthenticationProviderData;
 }