/// <summary> /// <para>Gets the configuration object <see cref="Type"/> for the factory to create given the <paramref name="authenticationProviderName"/>.</para> /// </summary> /// <param name="authenticationProviderName"> /// <para>The name of the <see cref="IAuthenticationProvider"/> to create.</para> /// </param> /// <returns> /// <para>The <see cref="Type"/> of the <see cref="IAuthenticationProvider"/> to create.</para> /// </returns> protected override Type GetConfigurationType(string authenticationProviderName) { SecurityConfigurationView securityConfigurationView = (SecurityConfigurationView)CreateConfigurationView(); AuthenticationProviderData authenticationProviderData = securityConfigurationView.GetAuthenticationProviderData(authenticationProviderName); return(GetType(authenticationProviderData.TypeName)); }
/// <summary> /// Initializes a new instance of the /// <see cref="AuthenticationProviderNode"/> class from /// the specified display name and <see cref="AuthenticationProviderData"/>. /// </summary> /// <param name="authenticationProviderData">An <see cref="AuthenticationProviderData"/>.</param> protected AuthenticationProviderNode(AuthenticationProviderData authenticationProviderData) : base(/*SR.AuthenticationProviderNodeName*/) { if (authenticationProviderData == null) { throw new ArgumentNullException("data"); } this.authenticationProviderData = authenticationProviderData; }
/// <summary> /// Initializes a new instance of the /// <see cref="AuthenticationProviderNode"/> class from /// the specified display name and <see cref="AuthenticationProviderData"/>. /// </summary> /// <param name="authenticationProviderData">An <see cref="AuthenticationProviderData"/>.</param> protected AuthenticationProviderNode(AuthenticationProviderData authenticationProviderData) : base(/*SR.AuthenticationProviderNodeName*/) { if (authenticationProviderData == null) { throw new ArgumentNullException("data"); } this.authenticationProviderData = authenticationProviderData; }
/// <summary> /// <para>Gets the named <see cref="AuthenticationProviderData"/> from configuration.</para> /// </summary> /// <param name="authenticationProviderName"> /// <para>The name of the <see cref="AuthenticationProviderData"/> to get the data.</para> /// </param> /// <returns> /// <para>The named <see cref="AuthenticationProviderData"/> from configuration.</para> /// </returns> public virtual AuthenticationProviderData GetAuthenticationProviderData(string authenticationProviderName) { SecuritySettings settings = GetSecuritySettings(); AuthenticationProviderData data = settings.AuthenticationProviders[authenticationProviderName]; if (data == null) { throw new ConfigurationException(SR.ExceptionAuthenticationProviderNotFound(authenticationProviderName)); } return(data); }
public void IndexerTest() { AuthenticationProviderDataCollection collection = new AuthenticationProviderDataCollection(); MockAuthenticationProviderData providerData = new MockAuthenticationProviderData(); providerData.Name = "provider1"; collection[providerData.Name] = providerData; Assert.AreEqual(1, collection.Count); AuthenticationProviderData compareData = collection["provider1"]; Assert.AreSame(providerData, compareData); }
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); }