use of io.restassured.filter.session.SessionFilter in project ddf by codice.
the class JettySessionManagementTest method sessionsMaintainAttributesBetweenContexts.
@Test
public void sessionsMaintainAttributesBetweenContexts() {
SessionFilter sessionFilter = new SessionFilter();
logIntoBothContexts(sessionFilter);
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/addSessionAttribute", port)).then().statusCode(is(SC_OK));
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context2/checkSessionAttribute", port)).then().statusCode(is(SC_OK));
}
use of io.restassured.filter.session.SessionFilter in project ddf by codice.
the class JettySessionManagementTest method sessionAreNotUsableWhenInvalidated.
@Test
public void sessionAreNotUsableWhenInvalidated() {
SessionFilter sessionFilter = new SessionFilter();
String sessionId = RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/newSession", port)).then().statusCode(is(SC_OK)).extract().sessionId();
assertThat(sessionId, is(not(nullValue())));
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/existingSession", port)).then().statusCode(is(SC_OK));
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/invalidateSession", port)).then().statusCode(is(SC_OK));
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/existingSession", port)).then().statusCode(is(SC_BAD_REQUEST));
}
use of io.restassured.filter.session.SessionFilter in project ddf by codice.
the class JettySessionManagementTest method sessionsAreRefreshedAcrossContexts.
@Test
public void sessionsAreRefreshedAcrossContexts() throws InterruptedException {
SessionFilter sessionFilter = new SessionFilter();
logIntoBothContexts(sessionFilter);
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/existingSession", port)).then().statusCode(is(SC_OK));
Thread.sleep((SCAVENGE_INTERVAL_SECONDS + 1) * 1000);
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context2/existingSession", port)).then().statusCode(is(SC_OK));
Thread.sleep((SCAVENGE_INTERVAL_SECONDS + 1) * 1000);
RestAssured.given().filter(sessionFilter).get(String.format("http://localhost:%s/context1/existingSession", port)).then().statusCode(is(SC_OK));
}
use of io.restassured.filter.session.SessionFilter in project rest-assured by rest-assured.
the class AuthenticationITest method sessionFilterRecordsAndProvidesTheSessionIdWhenSessionNameIsNotDefault.
@Test
public void sessionFilterRecordsAndProvidesTheSessionIdWhenSessionNameIsNotDefault() throws Exception {
final SessionFilter sessionFilter = new SessionFilter();
given().config(RestAssuredConfig.newConfig().sessionConfig(sessionConfig().sessionIdName("phpsessionid"))).auth().form("John", "Doe", new FormAuthConfig("/j_spring_security_check_phpsessionid", "j_username", "j_password")).filter(sessionFilter).expect().statusCode(200).body(equalTo("OK")).when().get("/formAuth");
assertThat(sessionFilter.getSessionId(), equalTo("1234"));
}
use of io.restassured.filter.session.SessionFilter in project rest-assured by rest-assured.
the class AuthenticationITest method sessionFilterRecordsAndProvidesTheSessionId.
@Test
public void sessionFilterRecordsAndProvidesTheSessionId() throws Exception {
final SessionFilter sessionFilter = new SessionFilter();
given().auth().form("John", "Doe").filter(sessionFilter).expect().statusCode(200).body(equalTo("OK")).when().get("/formAuth");
assertThat(sessionFilter.getSessionId(), equalTo("1234"));
}
Aggregations