Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Added support for specifying how violations are handled (using conf…

…iguration.Advanced.Violations).

- Added and implemented specs for specifying how violations are handled (AdvancedConfiguration).
- Added and implemented specs for PolicyTypeToPolicyViolationHandlerInstanceConvention.
- Added and implemented specs for PolicyTypeToPolicyViolationHandlerTypeConvention.
- Added and implemented specs for using predicates with LazyInstancePolicyViolationHandlerConvention.
- Added and implemented specs for using predicates with LazyTypePolicyViolationHandlerConvention.
- Added ViolationsExpression and ViolationHandlerExpression<T>.
- Added As<T> extension method for objects (used when testing) to Specificaton project.
  • Loading branch information...
commit af53bbfc690addb2a77b8b8ddaf44cb20b27f5bc 1 parent ae78bbc
Kristoffer Ahl authored
Showing with 327 additions and 10 deletions.
  1. +83 −5 FluentSecurity.Specification/Configuration/AdvancedConfigurationSpec.cs
  2. +5 −0 FluentSecurity.Specification/FluentSecurity.Specification.csproj
  3. +10 −0 FluentSecurity.Specification/Helpers/TestingExtensions.cs
  4. +23 −0 ...rity.Specification/Policy/ViolationHandlers/Conventions/LazyInstancePolicyViolationHandlerConventionSpec.cs
  5. +23 −0 ...Security.Specification/Policy/ViolationHandlers/Conventions/LazyTypePolicyViolationHandlerConventionSpec.cs
  6. +41 −0 ...cification/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerInstanceConventionSpec.cs
  7. +43 −0 ....Specification/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerTypeConventionSpec.cs
  8. +6 −0 FluentSecurity/Configuration/AdvancedConfiguration.cs
  9. +26 −0 FluentSecurity/Configuration/ViolationHandlerExpression.cs
  10. +25 −0 FluentSecurity/Configuration/ViolationsExpression.cs
  11. +4 −0 FluentSecurity/FluentSecurity.csproj
  12. +1 −1  FluentSecurity/Policy/ViolationHandlers/Conventions/DefaultPolicyViolationHandlerIsOfTypeConvention.cs
  13. +9 −2 FluentSecurity/Policy/ViolationHandlers/Conventions/LazyInstancePolicyViolationHandlerConvention.cs
  14. +12 −2 FluentSecurity/Policy/ViolationHandlers/Conventions/LazyTypePolicyViolationHandlerConvention.cs
  15. +9 −0 FluentSecurity/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerInstanceConvention.cs
  16. +7 −0 FluentSecurity/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerTypeConvention.cs
View
88 FluentSecurity.Specification/Configuration/AdvancedConfigurationSpec.cs
@@ -2,7 +2,10 @@
using System.Linq;
using FluentSecurity.Caching;
using FluentSecurity.Configuration;
+using FluentSecurity.Policy;
using FluentSecurity.Policy.ViolationHandlers.Conventions;
+using FluentSecurity.Specification.Helpers;
+using FluentSecurity.Specification.TestData;
using NUnit.Framework;
namespace FluentSecurity.Specification.Configuration
@@ -11,30 +14,30 @@ namespace FluentSecurity.Specification.Configuration
[Category("AdvancedConfigurationSpec")]
public class When_creating_a_new_advanced_configuration
{
- private IAdvancedConfiguration advancedConfiguration;
+ private IAdvancedConfiguration _advancedConfiguration;
[SetUp]
public void SetUp()
{
- advancedConfiguration = new AdvancedConfiguration();
+ _advancedConfiguration = new AdvancedConfiguration();
}
[Test]
public void Should_have_default_policy_cache_lifecycle_set_to_DoNotCache()
{
- Assert.That(advancedConfiguration.DefaultResultsCacheLifecycle, Is.EqualTo(Cache.DoNotCache));
+ Assert.That(_advancedConfiguration.DefaultResultsCacheLifecycle, Is.EqualTo(Cache.DoNotCache));
}
[Test]
public void Should_not_have_a_security_context_modifyer()
{
- Assert.That(advancedConfiguration.SecurityContextModifyer, Is.Null);
+ Assert.That(_advancedConfiguration.SecurityContextModifyer, Is.Null);
}
[Test]
public void Should_have_conventions_for_default_PolicyViolationHandler_applied()
{
- var conventions = advancedConfiguration.Conventions.OfType<IPolicyViolationHandlerConvention>().ToList();
+ var conventions = _advancedConfiguration.Conventions.OfType<IPolicyViolationHandlerConvention>().ToList();
Assert.That(conventions.ElementAtOrDefault(0), Is.TypeOf<FindByPolicyNameConvention>());
Assert.That(conventions.ElementAtOrDefault(1), Is.TypeOf<FindDefaultPolicyViolationHandlerByNameConvention>());
}
@@ -129,4 +132,79 @@ public void Should_modify_context_on_creation()
Assert.That(context.Data.Property2, Is.EqualTo("Value2"));
}
}
+
+ [TestFixture]
+ [Category("AdvancedConfigurationSpec")]
+ public class When_specifying_how_violations_are_handled
+ {
+ private AdvancedConfiguration _advancedConfiguration;
+
+ [SetUp]
+ public void SetUp()
+ {
+ _advancedConfiguration = new AdvancedConfiguration();
+ }
+
+ [Test]
+ public void Should_throw_when_null_is_passed_to_Violations()
+ {
+ Assert.Throws<ArgumentNullException>(() => _advancedConfiguration.Violations(null));
+ }
+
+ [Test]
+ public void Should_always_add_conventions_at_the_first_position()
+ {
+ // Act
+ _advancedConfiguration.Violations(violations =>
+ {
+ violations.AddConvention(new Convention(expectedIndex: 2));
+ violations.AddConvention(new Convention(expectedIndex: 1));
+ violations.AddConvention(new Convention(expectedIndex: 0));
+ });
+
+ // Assert
+ Assert.That(_advancedConfiguration.Conventions.ElementAt(0).As<Convention>().ExpectedIndex, Is.EqualTo(0));
+ Assert.That(_advancedConfiguration.Conventions.ElementAt(1).As<Convention>().ExpectedIndex, Is.EqualTo(1));
+ Assert.That(_advancedConfiguration.Conventions.ElementAt(2).As<Convention>().ExpectedIndex, Is.EqualTo(2));
+ }
+
+ [Test]
+ public void Should_add_convention_for_IgnorePolicy_and_Handler1()
+ {
+ // Act
+ _advancedConfiguration.Violations(violations => violations.Of<IgnorePolicy>().IsHandledBy<Handler1>());
+
+ // Assert
+ Assert.That(_advancedConfiguration.Conventions.First(), Is.InstanceOf<PolicyTypeToPolicyViolationHandlerTypeConvention<IgnorePolicy, Handler1>>());
+ }
+
+ [Test]
+ public void Should_add_convention_for_IgnorePolicy_and_Handler2()
+ {
+ // Act
+ _advancedConfiguration.Violations(violations => violations.Of<IgnorePolicy>().IsHandledBy(() => new Handler2()));
+
+ // Assert
+ Assert.That(_advancedConfiguration.Conventions.First(), Is.InstanceOf<PolicyTypeToPolicyViolationHandlerInstanceConvention<IgnorePolicy, Handler2>>());
+ }
+
+ public class Convention : IPolicyViolationHandlerConvention
+ {
+ public int ExpectedIndex { get; private set; }
+
+ public Convention(int expectedIndex)
+ {
+ ExpectedIndex = expectedIndex;
+ }
+
+ public IPolicyViolationHandler GetHandlerFor(PolicyViolationException exception)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class Handler1 : DefaultPolicyViolationHandler {}
+
+ public class Handler2 : DefaultPolicyViolationHandler {}
+ }
}
View
5 FluentSecurity.Specification/FluentSecurity.Specification.csproj
@@ -117,10 +117,15 @@
<Compile Include="Helpers\MvcMockHelpers.cs" />
<Compile Include="Helpers\NameHelper.cs" />
<Compile Include="Helpers\ResetFixture.cs" />
+ <Compile Include="Helpers\TestingExtensions.cs" />
<Compile Include="HttpContextRequestDescriptionSpec.cs" />
<Compile Include="Helpers\MockSecurityContext.cs" />
<Compile Include="PolicyResultCacheKeyBuilderSpec.cs" />
<Compile Include="PolicyResultSpec.cs" />
+ <Compile Include="Policy\ViolationHandlers\Conventions\LazyInstancePolicyViolationHandlerConventionSpec.cs" />
+ <Compile Include="Policy\ViolationHandlers\Conventions\LazyTypePolicyViolationHandlerConventionSpec.cs" />
+ <Compile Include="Policy\ViolationHandlers\Conventions\PolicyTypeToPolicyViolationHandlerInstanceConventionSpec.cs" />
+ <Compile Include="Policy\ViolationHandlers\Conventions\PolicyTypeToPolicyViolationHandlerTypeConventionSpec.cs" />
<Compile Include="Policy\ViolationHandlers\Conventions\DefaultPolicyViolationHandlerIsInstanceConventionSpec.cs" />
<Compile Include="Policy\ViolationHandlers\Conventions\DefaultPolicyViolationHandlerIsOfTypeConventionSpec.cs" />
<Compile Include="Policy\ViolationHandlers\Conventions\FindByPolicyNameConventionSpec.cs" />
View
10 FluentSecurity.Specification/Helpers/TestingExtensions.cs
@@ -0,0 +1,10 @@
+namespace FluentSecurity.Specification.Helpers
+{
+ public static class TestingExtensions
+ {
+ public static T As<T>(this object obj) where T : class
+ {
+ return obj as T;
+ }
+ }
+}
View
23 ...y.Specification/Policy/ViolationHandlers/Conventions/LazyInstancePolicyViolationHandlerConventionSpec.cs
@@ -0,0 +1,23 @@
+using System;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+using FluentSecurity.Specification.TestData;
+using NUnit.Framework;
+
+namespace FluentSecurity.Specification.Policy.ViolationHandlers.Conventions
+{
+ [TestFixture]
+ [Category("LazyInstancePolicyViolationHandlerConventionSpec")]
+ public class When_creating_a_LazyInstancePolicyViolationHandlerConvention
+ {
+ [Test]
+ public void Should_throw_when_predicate_is_null()
+ {
+ Assert.Throws<ArgumentNullException>(() => new DerrivedLazyInstancePolicyViolationHandlerConvention());
+ }
+
+ public class DerrivedLazyInstancePolicyViolationHandlerConvention : LazyInstancePolicyViolationHandlerConvention<DefaultPolicyViolationHandler>
+ {
+ public DerrivedLazyInstancePolicyViolationHandlerConvention() : base(() => new DefaultPolicyViolationHandler(), null) {}
+ }
+ }
+}
View
23 ...urity.Specification/Policy/ViolationHandlers/Conventions/LazyTypePolicyViolationHandlerConventionSpec.cs
@@ -0,0 +1,23 @@
+using System;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+using FluentSecurity.Specification.TestData;
+using NUnit.Framework;
+
+namespace FluentSecurity.Specification.Policy.ViolationHandlers.Conventions
+{
+ [TestFixture]
+ [Category("LazyTypePolicyViolationHandlerConventionSpec")]
+ public class When_creating_a_LazyTypePolicyViolationHandlerConvention
+ {
+ [Test]
+ public void Should_throw_when_predicate_is_null()
+ {
+ Assert.Throws<ArgumentNullException>(() => new DerrivedLazyTypePolicyViolationHandlerConvention());
+ }
+
+ public class DerrivedLazyTypePolicyViolationHandlerConvention : LazyTypePolicyViolationHandlerConvention<DefaultPolicyViolationHandler>
+ {
+ public DerrivedLazyTypePolicyViolationHandlerConvention() : base(null) {}
+ }
+ }
+}
View
41 ...ication/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerInstanceConventionSpec.cs
@@ -0,0 +1,41 @@
+using FluentSecurity.Policy;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+using FluentSecurity.Specification.Helpers;
+using FluentSecurity.Specification.TestData;
+using NUnit.Framework;
+
+namespace FluentSecurity.Specification.Policy.ViolationHandlers.Conventions
+{
+ [TestFixture]
+ [Category("PolicyTypeToPolicyViolationHandlerInstanceConventionSpec")]
+ public class When_getting_a_handler_using_PolicyTypeToPolicyViolationHandlerInstanceConvention
+ {
+ [Test]
+ public void Should_return_handler_when_policy_type_is_match()
+ {
+ // Arrange
+ var convention = new PolicyTypeToPolicyViolationHandlerInstanceConvention<DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>(() => new DefaultPolicyViolationHandler());
+ var exception = TestDataFactory.CreateExceptionFor(new DenyAnonymousAccessPolicy());
+
+ // Act
+ var handler = convention.GetHandlerFor(exception);
+
+ // Assert
+ Assert.That(handler, Is.InstanceOf<DefaultPolicyViolationHandler>());
+ }
+
+ [Test]
+ public void Should_return_handler_when_policy_type_is_not_match()
+ {
+ // Arrange
+ var convention = new PolicyTypeToPolicyViolationHandlerInstanceConvention<DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>(() => new DefaultPolicyViolationHandler());
+ var exception = TestDataFactory.CreateExceptionFor(new IgnorePolicy());
+
+ // Act
+ var handler = convention.GetHandlerFor(exception);
+
+ // Assert
+ Assert.That(handler, Is.Null);
+ }
+ }
+}
View
43 ...ecification/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerTypeConventionSpec.cs
@@ -0,0 +1,43 @@
+using FluentSecurity.Policy;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+using FluentSecurity.Specification.Helpers;
+using FluentSecurity.Specification.TestData;
+using NUnit.Framework;
+
+namespace FluentSecurity.Specification.Policy.ViolationHandlers.Conventions
+{
+ [TestFixture]
+ [Category("PolicyTypeToPolicyViolationHandlerTypeConventionSpec")]
+ public class When_getting_a_handler_using_PolicyTypeToPolicyViolationHandlerTypeConvention
+ {
+ [Test]
+ public void Should_return_handler_when_policy_type_is_match()
+ {
+ // Arrange
+ var convention = new PolicyTypeToPolicyViolationHandlerTypeConvention<DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>();
+ convention.PolicyViolationHandlerProvider = t => new DefaultPolicyViolationHandler();
+ var exception = TestDataFactory.CreateExceptionFor(new DenyAnonymousAccessPolicy());
+
+ // Act
+ var handler = convention.GetHandlerFor(exception);
+
+ // Assert
+ Assert.That(handler, Is.InstanceOf<DefaultPolicyViolationHandler>());
+ }
+
+ [Test]
+ public void Should_return_handler_when_policy_type_is_not_match()
+ {
+ // Arrange
+ var convention = new PolicyTypeToPolicyViolationHandlerTypeConvention<DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>();
+ convention.PolicyViolationHandlerProvider = t => new DefaultPolicyViolationHandler();
+ var exception = TestDataFactory.CreateExceptionFor(new IgnorePolicy());
+
+ // Act
+ var handler = convention.GetHandlerFor(exception);
+
+ // Assert
+ Assert.That(handler, Is.Null);
+ }
+ }
+}
View
6 FluentSecurity/Configuration/AdvancedConfiguration.cs
@@ -30,5 +30,11 @@ public void ModifySecurityContext(Action<ISecurityContext> modifyer)
{
SecurityContextModifyer = modifyer;
}
+
+ public void Violations(Action<ViolationsExpression> violationsExpression)
+ {
+ if (violationsExpression == null) throw new ArgumentNullException("violationsExpression");
+ violationsExpression.Invoke(new ViolationsExpression(Conventions));
+ }
}
}
View
26 FluentSecurity/Configuration/ViolationHandlerExpression.cs
@@ -0,0 +1,26 @@
+using System;
+using FluentSecurity.Policy;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+
+namespace FluentSecurity.Configuration
+{
+ public class ViolationHandlerExpression<TSecurityPolicy> where TSecurityPolicy : class, ISecurityPolicy
+ {
+ private readonly ViolationsExpression _violationsExpression;
+
+ internal ViolationHandlerExpression(ViolationsExpression violationsExpression)
+ {
+ _violationsExpression = violationsExpression;
+ }
+
+ public void IsHandledBy<TPolicyViolationHandler>() where TPolicyViolationHandler : class, IPolicyViolationHandler
+ {
+ _violationsExpression.AddConvention(new PolicyTypeToPolicyViolationHandlerTypeConvention<TSecurityPolicy, TPolicyViolationHandler>());
+ }
+
+ public void IsHandledBy<TPolicyViolationHandler>(Func<TPolicyViolationHandler> policyViolationHandlerFactory) where TPolicyViolationHandler : class, IPolicyViolationHandler
+ {
+ _violationsExpression.AddConvention(new PolicyTypeToPolicyViolationHandlerInstanceConvention<TSecurityPolicy, TPolicyViolationHandler>(policyViolationHandlerFactory));
+ }
+ }
+}
View
25 FluentSecurity/Configuration/ViolationsExpression.cs
@@ -0,0 +1,25 @@
+using FluentSecurity.Policy;
+using FluentSecurity.Policy.ViolationHandlers.Conventions;
+
+namespace FluentSecurity.Configuration
+{
+ public class ViolationsExpression
+ {
+ private readonly Conventions _conventions;
+
+ internal ViolationsExpression(Conventions conventions)
+ {
+ _conventions = conventions;
+ }
+
+ public void AddConvention(IPolicyViolationHandlerConvention convention)
+ {
+ _conventions.Insert(0, convention);
+ }
+
+ public ViolationHandlerExpression<TSecurityPolicy> Of<TSecurityPolicy>() where TSecurityPolicy : class, ISecurityPolicy
+ {
+ return new ViolationHandlerExpression<TSecurityPolicy>(this);
+ }
+ }
+}
View
4 FluentSecurity/FluentSecurity.csproj
@@ -78,6 +78,8 @@
<Compile Include="Caching\SecurityCache.cs" />
<Compile Include="Configuration\AdvancedConfiguration.cs" />
<Compile Include="Configuration\IAdvancedConfiguration.cs" />
+ <Compile Include="Configuration\ViolationHandlerExpression.cs" />
+ <Compile Include="Configuration\ViolationsExpression.cs" />
<Compile Include="Conventions.cs" />
<Compile Include="ExceptionFactory.cs" />
<Compile Include="HttpContextRequestDescription.cs" />
@@ -112,6 +114,8 @@
<Compile Include="Policy\ViolationHandlers\Conventions\LazyTypePolicyViolationHandlerConvention.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Policy\ViolationHandlers\Conventions\PolicyTypeToPolicyViolationHandlerInstanceConvention.cs" />
+ <Compile Include="Policy\ViolationHandlers\Conventions\PolicyTypeToPolicyViolationHandlerTypeConvention.cs" />
<Compile Include="Policy\ViolationHandlers\Conventions\PolicyViolationHandlerFilterConvention.cs">
<SubType>Code</SubType>
</Compile>
View
2  FluentSecurity/Policy/ViolationHandlers/Conventions/DefaultPolicyViolationHandlerIsOfTypeConvention.cs
@@ -1,4 +1,4 @@
namespace FluentSecurity.Policy.ViolationHandlers.Conventions
{
- public class DefaultPolicyViolationHandlerIsOfTypeConvention<TPolicyViolationHandler> : LazyTypePolicyViolationHandlerConvention<TPolicyViolationHandler> where TPolicyViolationHandler : IPolicyViolationHandler {}
+ public class DefaultPolicyViolationHandlerIsOfTypeConvention<TPolicyViolationHandler> : LazyTypePolicyViolationHandlerConvention<TPolicyViolationHandler> where TPolicyViolationHandler : class, IPolicyViolationHandler {}
}
View
11 FluentSecurity/Policy/ViolationHandlers/Conventions/LazyInstancePolicyViolationHandlerConvention.cs
@@ -6,15 +6,22 @@ public abstract class LazyInstancePolicyViolationHandlerConvention<TPolicyViolat
{
private readonly Func<TPolicyViolationHandler> _policyViolationHandlerFactory;
- protected LazyInstancePolicyViolationHandlerConvention(Func<TPolicyViolationHandler> policyViolationHandlerFactory)
+ public Func<PolicyResult, bool> Predicate { get; private set; }
+
+ protected LazyInstancePolicyViolationHandlerConvention(Func<TPolicyViolationHandler> policyViolationHandlerFactory) : this(policyViolationHandlerFactory, pr => true) {}
+
+ protected LazyInstancePolicyViolationHandlerConvention(Func<TPolicyViolationHandler> policyViolationHandlerFactory, Func<PolicyResult, bool> predicate)
{
if (policyViolationHandlerFactory == null) throw new ArgumentNullException("policyViolationHandlerFactory");
+ if (predicate == null) throw new ArgumentNullException("predicate");
+
_policyViolationHandlerFactory = policyViolationHandlerFactory;
+ Predicate = predicate;
}
public IPolicyViolationHandler GetHandlerFor(PolicyViolationException exception)
{
- return _policyViolationHandlerFactory.Invoke();
+ return Predicate.Invoke(exception.PolicyResult) ? _policyViolationHandlerFactory.Invoke() : null;
}
}
}
View
14 FluentSecurity/Policy/ViolationHandlers/Conventions/LazyTypePolicyViolationHandlerConvention.cs
@@ -2,11 +2,21 @@
namespace FluentSecurity.Policy.ViolationHandlers.Conventions
{
- public abstract class LazyTypePolicyViolationHandlerConvention<TPolicyViolationHandler> : PolicyViolationHandlerTypeConvention where TPolicyViolationHandler : IPolicyViolationHandler
+ public abstract class LazyTypePolicyViolationHandlerConvention<TPolicyViolationHandler> : PolicyViolationHandlerTypeConvention where TPolicyViolationHandler : class, IPolicyViolationHandler
{
+ public Func<PolicyResult, bool> Predicate { get; private set; }
+
+ protected LazyTypePolicyViolationHandlerConvention() : this(pr => true) {}
+
+ protected LazyTypePolicyViolationHandlerConvention(Func<PolicyResult, bool> predicate)
+ {
+ if (predicate == null) throw new ArgumentNullException("predicate");
+ Predicate = predicate;
+ }
+
public override Type GetHandlerTypeFor(PolicyViolationException exception)
{
- return typeof (TPolicyViolationHandler);
+ return Predicate.Invoke(exception.PolicyResult) ? typeof (TPolicyViolationHandler) : null;
}
}
}
View
9 FluentSecurity/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerInstanceConvention.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace FluentSecurity.Policy.ViolationHandlers.Conventions
+{
+ public class PolicyTypeToPolicyViolationHandlerInstanceConvention<TSecurityPolicy, TPolicyViolationHandler> : LazyInstancePolicyViolationHandlerConvention<TPolicyViolationHandler> where TPolicyViolationHandler : class, IPolicyViolationHandler
+ {
+ public PolicyTypeToPolicyViolationHandlerInstanceConvention(Func<TPolicyViolationHandler> policyViolationHandlerFactory) : base(policyViolationHandlerFactory, policyResult => policyResult.PolicyType == typeof(TSecurityPolicy)) {}
+ }
+}
View
7 FluentSecurity/Policy/ViolationHandlers/Conventions/PolicyTypeToPolicyViolationHandlerTypeConvention.cs
@@ -0,0 +1,7 @@
+namespace FluentSecurity.Policy.ViolationHandlers.Conventions
+{
+ public class PolicyTypeToPolicyViolationHandlerTypeConvention<TSecurityPolicy, TPolicyViolationHandler> : LazyTypePolicyViolationHandlerConvention<TPolicyViolationHandler> where TPolicyViolationHandler : class, IPolicyViolationHandler
+ {
+ public PolicyTypeToPolicyViolationHandlerTypeConvention() : base(policyResult => policyResult.PolicyType == typeof(TSecurityPolicy)) {}
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.