use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IndirectBasicAuthClientTests method testGetCredentialsBadCredentials.
@Test
public void testGetCredentialsBadCredentials() {
final IndirectBasicAuthClient basicAuthClient = getBasicAuthClient();
final String header = USERNAME + ":" + PASSWORD;
final MockWebContext context = getContextWithAuthorizationHeader("Basic " + Base64.getEncoder().encodeToString(header.getBytes(StandardCharsets.UTF_8)));
verifyGetCredentialsFailsWithAuthenticationRequired(basicAuthClient, context);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IndirectBasicAuthClientTests method testGetCredentialsBadFormatHeader.
@Test
public void testGetCredentialsBadFormatHeader() {
final IndirectBasicAuthClient basicAuthClient = getBasicAuthClient();
final MockWebContext context = getContextWithAuthorizationHeader("Basic fakeHeader");
verifyGetCredentialsFailsWithAuthenticationRequired(basicAuthClient, context);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class IndirectBasicAuthClientTests method testGetCredentialsMissingSemiColon.
@Test
public void testGetCredentialsMissingSemiColon() {
final IndirectBasicAuthClient basicAuthClient = getBasicAuthClient();
final MockWebContext context = getContextWithAuthorizationHeader("Basic " + Base64.getEncoder().encodeToString("fake".getBytes(StandardCharsets.UTF_8)));
verifyGetCredentialsFailsWithAuthenticationRequired(basicAuthClient, context);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DigestExtractorTests method testNotDigest.
@Test
public void testNotDigest() {
final MockWebContext context = MockWebContext.create();
final DigestCredentials credentials = digestExtractor.extract(context);
assertNull(credentials);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultAjaxRequestResolverTests method testRealAjaxRequest.
@Test
public void testRealAjaxRequest() {
final MockWebContext context = MockWebContext.create().addRequestHeader("X-Requested-With", "XMLHttpRequest");
assertTrue(resolver.isAjax(context));
}
Aggregations