Ejemplo n.º 1
0
 public void GetByNameTest()
 {
     HashProviderFactory factory = new HashProviderFactory(context);
     IHashProvider provider = factory.CreateHashProvider("provider1");
     Assert.IsNotNull(provider);
     Assert.IsTrue(provider is MockHashProvider);
 }
Ejemplo n.º 2
0
        public void GetMockHashProvider()
        {
            HashProviderFactory factory = new HashProviderFactory(new TestConfigurationContext());
            MockHashProvider    store   = (MockHashProvider)factory.CreateHashProvider("mockHashProvider1");

            Assert.IsNotNull(store);
        }
Ejemplo n.º 3
0
        public void GetByNameTest()
        {
            HashProviderFactory factory  = new HashProviderFactory(context);
            IHashProvider       provider = factory.CreateHashProvider("provider1");

            Assert.IsNotNull(provider);
            Assert.IsTrue(provider is MockHashProvider);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        /// <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);
        }
Ejemplo n.º 8
0
        public void ProviderNotFoundTest()
        {
            HashProviderFactory factory = new HashProviderFactory(context);

            factory.CreateHashProvider("provider3");
        }
Ejemplo n.º 9
0
 public void ProviderNotFoundTest()
 {
     HashProviderFactory factory = new HashProviderFactory(context);
     factory.CreateHashProvider("provider3");
 }
Ejemplo n.º 10
0
 public void GetMockHashProvider()
 {
     HashProviderFactory factory = new HashProviderFactory(new TestConfigurationContext());
     MockHashProvider store = (MockHashProvider) factory.CreateHashProvider("mockHashProvider1");
     Assert.IsNotNull(store);
 }