use of org.pac4j.core.context.WebContext in project pac4j by pac4j.
the class DefaultSecurityClientFinderTests method testBadClientOnRequest.
@Test
public void testBadClientOnRequest() {
final MockIndirectClient client = new MockIndirectClient(NAME, RedirectAction.redirect(LOGIN_URL), (Credentials) null, new CommonProfile());
final Clients clients = new Clients(client);
final WebContext context = MockWebContext.create().addRequestParameter(Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER, FAKE_VALUE);
TestsHelper.expectException(() -> finder.find(clients, context, NAME), TechnicalException.class, "No client found for name: " + FAKE_VALUE);
}
use of org.pac4j.core.context.WebContext in project pac4j by pac4j.
the class CsrfAuthorizerTests method testParameterOkNewName.
@Test
public void testParameterOkNewName() {
final WebContext context = MockWebContext.create().addRequestParameter(NAME, VALUE).addSessionAttribute(Pac4jConstants.CSRF_TOKEN, VALUE);
authorizer.setParameterName(NAME);
Assert.assertTrue(authorizer.isAuthorized(context, null));
}
use of org.pac4j.core.context.WebContext in project pac4j by pac4j.
the class CsrfAuthorizerTests method testParameterOk.
@Test
public void testParameterOk() {
final WebContext context = MockWebContext.create().addRequestParameter(Pac4jConstants.CSRF_TOKEN, VALUE).addSessionAttribute(Pac4jConstants.CSRF_TOKEN, VALUE);
Assert.assertTrue(authorizer.isAuthorized(context, null));
}
use of org.pac4j.core.context.WebContext in project pac4j by pac4j.
the class CsrfAuthorizerTests method testHeaderOk.
@Test
public void testHeaderOk() {
final WebContext context = MockWebContext.create().addRequestHeader(Pac4jConstants.CSRF_TOKEN, VALUE).addSessionAttribute(Pac4jConstants.CSRF_TOKEN, VALUE);
Assert.assertTrue(authorizer.isAuthorized(context, null));
}
use of org.pac4j.core.context.WebContext in project ddf by codice.
the class OidcTokenValidatorTest method testValidateIdTokensNoNonce.
@Test(expected = OidcValidationException.class)
public void testValidateIdTokensNoNonce() throws Exception {
WebContext context = getWebContext();
String stringJwt = getIdTokenBuilder().sign(validAlgorithm);
JWT jwt = SignedJWT.parse(stringJwt);
OidcTokenValidator.validateIdTokens(jwt, context, configuration, oidcClient);
}
Aggregations