public void SetUp() { theSettings = new AuthenticationSettings(); theSystemTime = new SettableClock(); theRule = new LockedOutRule(theSettings, theSystemTime); }
public void apply_a_custome_exclusion_and_it_does_not_apply_to_login_page() { var settings = new AuthenticationSettings(); var chain = new RoutedChain("foo"); chain.AddToEnd(ActionCall.For<LoginController>(x => x.get_login(null))); settings.ShouldBeExcluded(chain).ShouldBeTrue(); settings.ExcludeChains = c => c.Calls.Count() == 5; // just need a fake settings.ShouldBeExcluded(chain).ShouldBeTrue(); }
public void apply_a_custom_exclusion() { var chain = new RoutedChain("foo"); chain.AddToEnd(ActionCall.For<AuthenticatedEndpoints>(x => x.get_tag())); var settings = new AuthenticationSettings(); settings.ShouldBeExcluded(chain).ShouldBeFalse(); settings.ExcludeChains = c => typeof (HtmlTag) == c.ResourceType(); settings.ShouldBeExcluded(chain).ShouldBeTrue(); }
public LockedOutRule(AuthenticationSettings settings, ISystemTime systemTime) { _settings = settings; _systemTime = systemTime; }
public void exclude_by_default_if_the_input_type_is_marked_as_NotAuthenticated() { var chain = new RoutedChain("bar"); chain.AddToEnd(ActionCall.For<AuthenticatedEndpoints>(x => x.post_something(null))); var settings = new AuthenticationSettings(); settings.ShouldBeExcluded(chain).ShouldBeTrue(); }
public void exclude_by_default_actions_marked_as_pass_through() { var chain = new RoutedChain("foo"); chain.AddToEnd(ActionCall.For<AuthenticatedEndpoints>(x => x.get_pass_through_authentication())); var settings = new AuthenticationSettings(); settings.ShouldBeExcluded(chain).ShouldBeTrue(); }
public void excludes_is_always_false_with_no_exclusions() { var settings = new AuthenticationSettings(); settings.ShouldBeExcluded(new RoutedChain("foo")).ShouldBeFalse(); }