use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultAjaxRequestResolverTests method testForcedAjaxParameter.
@Test
public void testForcedAjaxParameter() {
final MockWebContext context = MockWebContext.create().addRequestParameter("is_ajax_request", "true");
assertTrue(resolver.isAjax(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class PathParameterCallbackUrlResolverTests method testMatchesSimplePath.
@Test
public void testMatchesSimplePath() {
final MockWebContext context = MockWebContext.create();
context.setPath(CLIENT_NAME);
assertTrue(resolver.matches(CLIENT_NAME, context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class QueryParameterCallbackUrlResolverTests method testMatches.
@Test
public void testMatches() {
final MockWebContext context = MockWebContext.create();
context.addRequestParameter(Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER, 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_whenHostIsPresent.
@Test
public void testCompute_whenHostIsPresent() {
final MockWebContext context = MockWebContext.create();
context.setServerName("pac4j.com");
final String result = resolver.compute("http://cashost.com/cas/login", context);
assertEquals("http://cashost.com/cas/login", result);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultUrlResolverTests method testCompute_whenServerIsNotUsingDefaultHttpsPort.
@Test
public void testCompute_whenServerIsNotUsingDefaultHttpsPort() {
final MockWebContext context = MockWebContext.create();
context.setServerName("pac4j.com");
context.setScheme("https");
context.setSecure(true);
context.setServerPort(8181);
final String result = resolver.compute("/cas/login", context);
assertEquals("https://pac4j.com:8181/cas/login", result);
}
Aggregations