public void GetByNameTest() { HashProviderFactory factory = new HashProviderFactory(context); IHashProvider provider = factory.CreateHashProvider("provider1"); Assert.IsNotNull(provider); Assert.IsTrue(provider is MockHashProvider); }
public void GetMockHashProvider() { HashProviderFactory factory = new HashProviderFactory(new TestConfigurationContext()); MockHashProvider store = (MockHashProvider)factory.CreateHashProvider("mockHashProvider1"); Assert.IsNotNull(store); }
public void GetByNameTest() { HashProviderFactory factory = new HashProviderFactory(context); IHashProvider provider = factory.CreateHashProvider("provider1"); Assert.IsNotNull(provider); Assert.IsTrue(provider is MockHashProvider); }
public void GetProvider1() { HashProviderFactory factory = new HashProviderFactory(context); IHashProvider provider = factory.CreateHashProvider("provider1"); Assert.IsNotNull(provider); MockHashProvider mockProvider = provider as MockHashProvider; Assert.IsNotNull(mockProvider); Assert.IsTrue(mockProvider.Initialized); }
public void GetProvider1() { HashProviderFactory factory = new HashProviderFactory(context); IHashProvider provider = factory.CreateHashProvider("provider1"); Assert.IsNotNull(provider); MockHashProvider mockProvider = provider as MockHashProvider; Assert.IsNotNull(mockProvider); Assert.IsTrue(mockProvider.Initialized); }
public UserForm(DbAuthenticationProviderData dbAuthenticationProvider, ConfigurationContext context) { this.dbAuthenticationProvider = dbAuthenticationProvider; InitializeComponent(); this.userRoleMgr = new UserRoleManager(dbAuthenticationProvider.Database, context); HashProviderFactory hashProviderFactory = new HashProviderFactory(context); this.hashProvider = hashProviderFactory.CreateHashProvider(dbAuthenticationProvider.HashProvider); UpdateSaveButtonEnabled(); }
/// <devdoc> /// Compares the password passed in against the password stored in the database. /// </devdoc> private bool PasswordsMatch(byte[] password, string userName) { DbAuthenticationProviderData dbAuthenticationProviderData = (DbAuthenticationProviderData)securityConfigurationView.GetAuthenticationProviderData(ConfigurationName); bool result = false; UserRoleManager manager = new UserRoleManager(dbAuthenticationProviderData.Database, securityConfigurationView.ConfigurationContext); byte[] hashedPassword = manager.GetPassword(userName); if (hashedPassword != null) { HashProviderFactory hashFactory = new HashProviderFactory(securityConfigurationView.ConfigurationContext); IHashProvider hashProvider = hashFactory.CreateHashProvider(dbAuthenticationProviderData.HashProvider); result = hashProvider.CompareHash(password, hashedPassword); } return(result); }
public void ProviderNotFoundTest() { HashProviderFactory factory = new HashProviderFactory(context); factory.CreateHashProvider("provider3"); }
public void ProviderNotFoundTest() { HashProviderFactory factory = new HashProviderFactory(context); factory.CreateHashProvider("provider3"); }
public void GetMockHashProvider() { HashProviderFactory factory = new HashProviderFactory(new TestConfigurationContext()); MockHashProvider store = (MockHashProvider) factory.CreateHashProvider("mockHashProvider1"); Assert.IsNotNull(store); }