use of org.icij.datashare.session.LocalUserFilter in project datashare by ICIJ.
the class DocumentResourceTest method setUp.
@Before
public void setUp() {
initMocks(this);
configure(routes -> routes.add(new DocumentResource(repository, indexer)).filter(new LocalUserFilter(new PropertiesProvider())));
}
use of org.icij.datashare.session.LocalUserFilter in project datashare by ICIJ.
the class IndexResourceTest method test_no_auth_post_forward_request_to_elastic_with_body.
@Test
public void test_no_auth_post_forward_request_to_elastic_with_body() {
configure(routes -> routes.add(new IndexResource(indexer)).filter(new LocalUserFilter(new PropertiesProvider(new HashMap<String, String>() {
{
put("defaultUserName", "test");
}
}))));
post("/api/index/search/test-datashare/_search", "{}").should().respond(200).contain("\"successful\":1");
}
use of org.icij.datashare.session.LocalUserFilter in project datashare by ICIJ.
the class IndexResourceTest method test_no_auth_options_forward_request_to_elastic.
@Test
public void test_no_auth_options_forward_request_to_elastic() {
configure(routes -> routes.add(new IndexResource(indexer)).filter(new LocalUserFilter(new PropertiesProvider(new HashMap<String, String>() {
{
put("defaultUserName", "test");
}
}))));
options("/api/index/search/test-datashare").should().respond(200);
}
use of org.icij.datashare.session.LocalUserFilter in project datashare by ICIJ.
the class IndexResourceTest method test_no_auth_get_forward_request_to_elastic_if_granted_to_read_index.
@Test
public void test_no_auth_get_forward_request_to_elastic_if_granted_to_read_index() {
configure(routes -> routes.add(new IndexResource(indexer)).filter(new LocalUserFilter(new PropertiesProvider(new HashMap<String, String>() {
{
put("defaultUserName", "test");
}
}))));
get("/api/index/search/unauthorized/_search").should().respond(401);
}
use of org.icij.datashare.session.LocalUserFilter in project datashare by ICIJ.
the class NoteResourceTest method setUp.
@Before
public void setUp() {
initMocks(this);
configure(routes -> routes.add(new NoteResource(repository)).filter(new LocalUserFilter(new PropertiesProvider())));
}
Aggregations