Search in sources :

Example 1 with LocalUserFilter

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())));
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) Before(org.junit.Before)

Example 2 with LocalUserFilter

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");
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) HashMap(java.util.HashMap) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Example 3 with LocalUserFilter

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);
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) HashMap(java.util.HashMap) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Example 4 with LocalUserFilter

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);
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) HashMap(java.util.HashMap) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Example 5 with LocalUserFilter

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())));
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) Before(org.junit.Before)

Aggregations

PropertiesProvider (org.icij.datashare.PropertiesProvider)12 LocalUserFilter (org.icij.datashare.session.LocalUserFilter)12 Before (org.junit.Before)6 HashMap (java.util.HashMap)5 AbstractProdWebServerTest (org.icij.datashare.web.testhelpers.AbstractProdWebServerTest)5 Test (org.junit.Test)5 BatchSearch (org.icij.datashare.batch.BatchSearch)1 BatchSearchRepository (org.icij.datashare.batch.BatchSearchRepository)1 SearchResult (org.icij.datashare.batch.SearchResult)1 JooqBatchSearchRepository (org.icij.datashare.db.JooqBatchSearchRepository)1