Search in sources :

Example 21 with Title

use of org.neo4j.test.TestData.Title in project neo4j by neo4j.

the class SecurityRulesIT method aComplexWildcardUriPathShould401OnAccessToProtectedSubPath.

@Test
@Title("Using Complex Wildcards to Target Security Rules")
@Documented("In this example, a security rule is registered to deny\n" + "access to all URIs matching a complex pattern.\n" + "The config looks like this:\n" + "\n" + "@@config\n" + "\n" + "with the rule source code of:\n" + "\n" + "@@failingRuleWithComplexWildcardPath")
public void aComplexWildcardUriPathShould401OnAccessToProtectedSubPath() throws Exception {
    String mountPoint = "/protected/wildcard_replacement/x/y/z/something/else/more_wildcard_replacement/a/b/c" + "/final/bit";
    server = CommunityServerBuilder.server().withDefaultDatabaseTuning().withThirdPartyJaxRsPackage("org.dummy.web.service", mountPoint).withSecurityRules(PermanentlyFailingSecurityRuleWithComplexWildcardPath.class.getCanonicalName()).usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
    server.start();
    functionalTestHelper = new FunctionalTestHelper(server);
    JaxRsResponse clientResponse = gen.get().expectedStatus(401).expectedType(MediaType.APPLICATION_JSON_TYPE).expectedHeader("WWW-Authenticate").get(trimTrailingSlash(functionalTestHelper.baseUri()) + mountPoint + "/more/stuff").response();
    assertEquals(401, clientResponse.getStatus());
}
Also used : FunctionalTestHelper(org.neo4j.server.helpers.FunctionalTestHelper) Matchers.containsString(org.hamcrest.Matchers.containsString) JaxRsResponse(org.neo4j.server.rest.JaxRsResponse) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test) Title(org.neo4j.test.TestData.Title)

Aggregations

Test (org.junit.Test)21 Title (org.neo4j.test.TestData.Title)21 Documented (org.neo4j.kernel.impl.annotations.Documented)19 Graph (org.neo4j.test.GraphDescription.Graph)18 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 Relationship (org.neo4j.graphdb.Relationship)4 FunctionalTestHelper (org.neo4j.server.helpers.FunctionalTestHelper)3 JaxRsResponse (org.neo4j.server.rest.JaxRsResponse)3 Map (java.util.Map)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Node (org.neo4j.graphdb.Node)2 Transaction (org.neo4j.graphdb.Transaction)2 JsonHelper.jsonToMap (org.neo4j.server.rest.domain.JsonHelper.jsonToMap)2 RelationshipRepresentationTest (org.neo4j.server.rest.repr.RelationshipRepresentationTest)2 Collection (java.util.Collection)1