use of org.pac4j.core.context.session.SessionStore in project pac4j by pac4j.
the class CsrfAuthorizerTests method testNoToken.
@Test
public void testNoToken() {
final WebContext context = MockWebContext.create();
final SessionStore sessionStore = new MockSessionStore();
sessionStore.set(context, Pac4jConstants.CSRF_TOKEN, VALUE);
sessionStore.set(context, Pac4jConstants.CSRF_TOKEN_EXPIRATION_DATE, expirationDate);
Assert.assertFalse(authorizer.isAuthorized(context, sessionStore, null));
}
use of org.pac4j.core.context.session.SessionStore in project pac4j by pac4j.
the class RedirectSAML2ClientTests method testRelayState.
@Test
public void testRelayState() {
final var client = getClient();
final WebContext context = MockWebContext.create();
final SessionStore sessionStore = new MockSessionStore();
sessionStore.set(context, SAML2StateGenerator.SAML_RELAY_STATE_ATTRIBUTE, "relayState");
final var action = (FoundAction) client.getRedirectionAction(context, sessionStore).get();
assertTrue(action.getLocation().contains("RelayState=relayState"));
}
Aggregations