use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultAjaxRequestResolverTests method testForcedAjaxHeader.
@Test
public void testForcedAjaxHeader() {
final MockWebContext context = MockWebContext.create().addRequestHeader("is_ajax_request", "true");
assertTrue(resolver.isAjax(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class PathParameterCallbackUrlResolverTests method testMatchesComplexPath.
@Test
public void testMatchesComplexPath() {
final MockWebContext context = MockWebContext.create();
context.setPath(VALUE + "/" + CLIENT_NAME);
assertTrue(resolver.matches(CLIENT_NAME, context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultUrlResolverTests method testCompute_whenHostIsNotPresent.
@Test
public void testCompute_whenHostIsNotPresent() {
final MockWebContext context = MockWebContext.create();
context.setServerName("pac4j.com");
final String result = resolver.compute("/cas/login", context);
assertEquals("http://pac4j.com/cas/login", result);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultUrlResolverTests method testComputePassthrough.
@Test
public void testComputePassthrough() {
final MockWebContext context = MockWebContext.create();
context.setServerName("pac4j.com");
final String result = new DefaultUrlResolver().compute(PATH, context);
assertEquals(PATH, result);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultUrlResolverTests method testCompute_whenRequestIsSecure.
@Test
public void testCompute_whenRequestIsSecure() {
final MockWebContext context = MockWebContext.create();
context.setScheme("https");
context.setSecure(true);
context.setServerPort(443);
final String result = resolver.compute("/cas/login", context);
assertEquals("https://localhost/cas/login", result);
}
Aggregations