use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HeaderMatcherTests method testRegexExpectedRightValueHeader.
@Test
public void testRegexExpectedRightValueHeader() {
final HeaderMatcher matcher = new HeaderMatcher(NAME, ".*A.*");
final MockWebContext context = MockWebContext.create().addRequestHeader(NAME, "BAC");
assertTrue(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HeaderMatcherTests method testNullExpectedValueHeader.
@Test
public void testNullExpectedValueHeader() {
final HeaderMatcher matcher = new HeaderMatcher(NAME, null);
final MockWebContext context = MockWebContext.create().addRequestHeader(NAME, VALUE);
assertFalse(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HeaderMatcherTests method testRegexExpectedNullHeader.
@Test
public void testRegexExpectedNullHeader() {
final HeaderMatcher matcher = new HeaderMatcher(NAME, ".*A.*");
final MockWebContext context = MockWebContext.create();
assertFalse(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HeaderMatcherTests method testRegexExpectedBadValueHeader.
@Test
public void testRegexExpectedBadValueHeader() {
final HeaderMatcher matcher = new HeaderMatcher(NAME, ".*A.*");
final MockWebContext context = MockWebContext.create().addRequestHeader(NAME, "BOC");
assertFalse(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultCallbackClientFinderTests method testPathParameter.
@Test
public void testPathParameter() {
final IndirectClient azure = new MockIndirectClient("azure");
azure.setCallbackUrlResolver(new PathParameterCallbackUrlResolver());
final Clients clients = new Clients(CALLBACK_URL, azure);
clients.init();
final MockWebContext context = MockWebContext.create().setPath("/ AZURE ");
final ClientFinder finder = new DefaultCallbackClientFinder();
final List<Client> result = finder.find(clients, context, null);
assertEquals(1, result.size());
assertEquals(azure, result.get(0));
}
Aggregations