use of org.pac4j.core.exception.HttpAction in project pac4j by pac4j.
the class DirectCasClientTests method testNoTokenRedirectionExpected.
@Test
public void testNoTokenRedirectionExpected() {
final CasConfiguration configuration = new CasConfiguration();
configuration.setLoginUrl(LOGIN_URL);
final DirectCasClient client = new DirectCasClient(configuration);
final MockWebContext context = MockWebContext.create();
context.setFullRequestURL(CALLBACK_URL);
final HttpAction action = (HttpAction) TestsHelper.expectException(() -> client.getCredentials(context));
assertEquals(302, action.getCode());
assertEquals(addParameter(LOGIN_URL, CasConfiguration.SERVICE_PARAMETER, CALLBACK_URL), context.getResponseHeaders().get(HttpConstants.LOCATION_HEADER));
}
Aggregations