use of org.pac4j.core.exception.http.SeeOtherAction in project pac4j by pac4j.
the class DefaultCallbackLogicTests method internalTestCallbackWithOriginallyRequestedUrl.
private void internalTestCallbackWithOriginallyRequestedUrl(final int code) {
final var originalSessionId = sessionStore.getSessionId(context, false);
sessionStore.set(context, Pac4jConstants.REQUESTED_URL, new FoundAction(PAC4J_URL));
context.addRequestParameter(Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER, NAME);
final var profile = new CommonProfile();
final IndirectClient indirectClient = new MockIndirectClient(NAME, null, Optional.of(new MockCredentials()), profile);
config.setClients(new Clients(CALLBACK_URL, indirectClient));
call();
final var newSessionId = sessionStore.getSessionId(context, false);
final var profiles = (LinkedHashMap<String, CommonProfile>) sessionStore.get(context, Pac4jConstants.USER_PROFILES).get();
assertTrue(profiles.containsValue(profile));
assertEquals(1, profiles.size());
assertNotEquals(newSessionId, originalSessionId);
assertEquals(code, action.getCode());
if (action instanceof SeeOtherAction) {
assertEquals(PAC4J_URL, ((SeeOtherAction) action).getLocation());
} else {
assertEquals(PAC4J_URL, ((FoundAction) action).getLocation());
}
}
Aggregations