Search in sources :

Example 1 with FormAuthConfig

use of io.restassured.authentication.FormAuthConfig 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"));
}
Also used : SessionFilter(io.restassured.filter.session.SessionFilter) FormAuthConfig(io.restassured.authentication.FormAuthConfig) Test(org.junit.Test)

Aggregations

FormAuthConfig (io.restassured.authentication.FormAuthConfig)1 SessionFilter (io.restassured.filter.session.SessionFilter)1 Test (org.junit.Test)1