use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IndirectBasicAuthClientTests method testGetCredentialsNotABasicHeader.
@Test
public void testGetCredentialsNotABasicHeader() {
final IndirectBasicAuthClient basicAuthClient = getBasicAuthClient();
final MockWebContext context = getContextWithAuthorizationHeader("fakeHeader");
verifyGetCredentialsFailsWithAuthenticationRequired(basicAuthClient, context);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IndirectBasicAuthClientTests method testRedirectionUrl.
@Test
public void testRedirectionUrl() {
final IndirectBasicAuthClient basicAuthClient = getBasicAuthClient();
MockWebContext context = MockWebContext.create();
basicAuthClient.redirect(context);
assertEquals(CALLBACK_URL + "?" + Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER + "=" + basicAuthClient.getName(), context.getResponseLocation());
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DigestExtractorTests method testRetrieveDigestHeaderComponents.
@Test
public void testRetrieveDigestHeaderComponents() {
final MockWebContext context = MockWebContext.create();
context.addRequestHeader(HttpConstants.AUTHORIZATION_HEADER, DIGEST_AUTHORIZATION_HEADER_VALUE);
final DigestCredentials credentials = digestExtractor.extract(context);
assertEquals(DIGEST_RESPONSE, credentials.getToken());
assertEquals(USERNAME, credentials.getUsername());
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IpExtractorTests method testNoIp.
@Test
public void testNoIp() {
final MockWebContext context = MockWebContext.create();
final TokenCredentials credentials = extractor.extract(context);
assertNull(credentials);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IpExtractorTests method testWrongProxyIp.
@Test
public void testWrongProxyIp() {
final MockWebContext context = MockWebContext.create();
final TokenCredentials credentials = extractor.extract(context);
assertNull(credentials);
}
Aggregations