Ejemplo n.º 1
0
        public void HashingServiceNoConfigTest()
        {
            var section = (Configuration.ConfigurationSection)Configuration.GetSection("Xtensive.Orm.Security.XXX");

            Assert.That(section, Is.Null);

            var config = SecurityConfiguration.Load(Configuration, "Xtensive.Orm.Security.XXX");

            Assert.That(config, Is.Not.Null);
            Assert.That(config.HashingServiceName, Is.EqualTo("plain"));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the security configuration.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <returns><see cref="SecurityConfiguration"/> instance.</returns>
        public static SecurityConfiguration GetSecurityConfiguration(this Session session)
        {
            var result = session.Domain.Extensions.Get <SecurityConfiguration>();

            if (result == null)
            {
                result = SecurityConfiguration.Load();
                session.Domain.Extensions.Set(result);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public void HashingServiceNoConfigTest()
        {
            var section = (Configuration.ConfigurationSection)ConfigurationManager.GetSection("Xtensive.Orm.Security.XXX");

            Assert.IsNull(section);

            var config = SecurityConfiguration.Load("Xtensive.Orm.Security.XXX");

            Assert.IsNotNull(config);
            Assert.AreEqual("plain", config.HashingServiceName);
        }
Ejemplo n.º 4
0
        public void HashingServiceDefaultTest()
        {
            var section = (Configuration.ConfigurationSection)Configuration.GetSection("Xtensive.Orm.Security");

            Assert.That(section, Is.Not.Null);
            Assert.That(section.HashingService, Is.Not.Null);
            Assert.That(section.HashingService.Name, Is.Not.Null.Or.Empty);
            Assert.That(section.HashingService.Name, Is.EqualTo("sha1"));

            var config = SecurityConfiguration.Load(Configuration);

            Assert.That(config, Is.Not.Null);
            Assert.That(config.HashingServiceName, Is.EqualTo("sha1"));
        }
Ejemplo n.º 5
0
        public void HashingServiceDefaultTest()
        {
            var section = (Configuration.ConfigurationSection)ConfigurationManager.GetSection("Xtensive.Orm.Security");

            Assert.IsNotNull(section);
            Assert.IsNotNull(section.HashingService);
            Assert.IsNotNullOrEmpty(section.HashingService.Name);
            Assert.AreEqual("sha1", section.HashingService.Name);

            var config = SecurityConfiguration.Load();

            Assert.IsNotNull(config);
            Assert.AreEqual("sha1", config.HashingServiceName);
        }
Ejemplo n.º 6
0
        public void HashingServiceNameTest()
        {
            var section = (Configuration.ConfigurationSection)ConfigurationManager.GetSection("Xtensive.Orm.Security.WithName");

            Assert.IsNotNull(section);
            Assert.IsNotNull(section.HashingService);
            Assert.IsNotNull(section.HashingService.Name);
            Assert.AreEqual("md5", section.HashingService.Name);

            var config = SecurityConfiguration.Load("Xtensive.Orm.Security.WithName");

            Assert.IsNotNull(config);
            Assert.AreEqual("md5", config.HashingServiceName);
        }