public PolicyContainer(string controllerName, string actionName, IPolicyAppender policyAppender) { if (controllerName.IsNullOrEmpty()) { throw new ArgumentException("Controllername must not be null or empty!", "controllerName"); } if (actionName.IsNullOrEmpty()) { throw new ArgumentException("Actionname must not be null or empty!", "actionName"); } if (policyAppender == null) { throw new ArgumentNullException("policyAppender"); } _policies = new List <ISecurityPolicy>(); ControllerName = controllerName; ActionName = actionName; PolicyAppender = policyAppender; CacheStrategies = new List <PolicyResultCacheStrategy>(); SecurityConfigurationProvider = () => SecurityConfiguration.Current; }
public virtual void SetUp() { Policies = new List <ISecurityPolicy>(); PolicyAppender = new DefaultPolicyAppender(); Context(); }
public void SetPolicyAppender(IPolicyAppender policyAppender) { if (policyAppender == null) { throw new ArgumentNullException("policyAppender"); } PolicyAppender = policyAppender; }
public void Should_throw_ArgumentException_when_policy_manager_is_null() { // Arrange const IPolicyAppender policyAppender = null; // Act & Assert Assert.Throws <ArgumentNullException>(() => new PolicyContainer(_validControllerName, _validActionName, policyAppender) ); }
public PolicyContainer(string controllerName, string actionName, IPolicyAppender policyAppender) { if (controllerName.IsNullOrEmpty()) throw new ArgumentException("Controllername must not be null or empty!", "controllerName"); if (actionName.IsNullOrEmpty()) throw new ArgumentException("Actionname must not be null or empty!", "actionName"); if (policyAppender == null) throw new ArgumentNullException("policyAppender"); _policies = new List<ISecurityPolicy>(); ControllerName = controllerName; ActionName = actionName; PolicyAppender = policyAppender; }
public void SetUp() { // Arrange _defaultPolicyAppender = TestDataFactory.CreateValidPolicyAppender(); _fakePolicyAppender = TestDataFactory.CreateFakePolicyAppender(); SecurityConfigurator.Reset(); // Act SecurityConfigurator.Configure(configuration => { configuration.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); configuration.GetRolesFrom(StaticHelper.GetRolesExcludingOwner); configuration.SetPolicyAppender(_defaultPolicyAppender); configuration.For <BlogController>(x => x.Index()).DenyAnonymousAccess(); configuration.SetPolicyAppender(_fakePolicyAppender); configuration.For <BlogController>(x => x.AddPost()).RequireRole(UserRole.Writer, UserRole.Publisher, UserRole.Owner); }); _policyContainers = SecurityConfiguration.Current.PolicyContainers; }
public PolicyContainer(string controllerName, string actionName, IPolicyAppender policyAppender) { if (controllerName.IsNullOrEmpty()) { throw new ArgumentException("Controllername must not be null or empty!", "controllerName"); } if (actionName.IsNullOrEmpty()) { throw new ArgumentException("Actionname must not be null or empty!", "actionName"); } if (policyAppender == null) { throw new ArgumentNullException("policyAppender"); } _policies = new List <ISecurityPolicy>(); ControllerName = controllerName; ActionName = actionName; PolicyAppender = policyAppender; }
public void SetUp() { _expectedControllerName = TestDataFactory.ValidControllerName; _expectedActionName = TestDataFactory.ValidActionName; _expectedPolicyAppender = TestDataFactory.CreateValidPolicyAppender(); }
public void SetUp() { // Arrange _defaultPolicyAppender = TestDataFactory.CreateValidPolicyAppender(); _fakePolicyAppender = TestDataFactory.CreateFakePolicyAppender(); SecurityConfigurator.Reset(); // Act SecurityConfigurator.Configure(configuration => { configuration.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); configuration.GetRolesFrom(StaticHelper.GetRolesExcludingOwner); configuration.SetPolicyAppender(_defaultPolicyAppender); configuration.For<BlogController>(x => x.Index()).DenyAnonymousAccess(); configuration.SetPolicyAppender(_fakePolicyAppender); configuration.For<BlogController>(x => x.AddPost()).RequireRole(UserRole.Writer, UserRole.Publisher, UserRole.Owner); }); _policyContainers = SecurityConfiguration.Current.PolicyContainers; }
public virtual void SetUp() { PolicyAppender = new DefaultPolicyAppender(); }
public ConfigurationExpression() { PolicyAppender = new DefaultPolicyAppender(); }
internal void Initialize(SecurityRuntime runtime) { Runtime = runtime; Advanced = new AdvancedConfiguration(Runtime); PolicyAppender = new DefaultPolicyAppender(); }
public void SetPolicyAppender(IPolicyAppender policyAppender) { PolicyAppender = policyAppender ?? throw new ArgumentNullException(nameof(policyAppender)); }
public virtual void SetUp() { Policies = new List<ISecurityPolicy>(); PolicyAppender = new DefaultPolicyAppender(); Context(); }