Search in sources :

Example 11 with AuthPolicy

use of org.apache.jena.fuseki.auth.AuthPolicy in project jena by apache.

the class TestAuthorized method auth_anon.

@Test
public void auth_anon() {
    AuthPolicy auth = Auth.ANY_ANON;
    assertTrue(auth.isAllowed(null));
    assertTrue(auth.isAllowed("user1"));
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) Test(org.junit.Test)

Example 12 with AuthPolicy

use of org.apache.jena.fuseki.auth.AuthPolicy in project jena by apache.

the class TestAuthorized method auth_user_1.

@Test
public void auth_user_1() {
    AuthPolicy auth = Auth.policyAllowSpecific("user1", "user2");
    assertFalse(auth.isAllowed(null));
    assertTrue(auth.isAllowed("user1"));
    assertTrue(auth.isAllowed("user2"));
    assertFalse(auth.isAllowed("user3"));
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) Test(org.junit.Test)

Example 13 with AuthPolicy

use of org.apache.jena.fuseki.auth.AuthPolicy in project jena by apache.

the class TestAuthorized method auth_parse_no_info_1.

@Test
public void auth_parse_no_info_1() {
    Resource r = model.createResource("http://example/notInData");
    AuthPolicy auth = FusekiConfig.allowedUsers(r);
    assertNull(auth);
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) Resource(org.apache.jena.rdf.model.Resource) Test(org.junit.Test)

Example 14 with AuthPolicy

use of org.apache.jena.fuseki.auth.AuthPolicy in project jena by apache.

the class TestAuthorized method auth_parse_no_info_2.

@Test
public void auth_parse_no_info_2() {
    Resource r = model.createResource("http://example/none");
    AuthPolicy auth = FusekiConfig.allowedUsers(r);
    assertNull(auth);
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) Resource(org.apache.jena.rdf.model.Resource) Test(org.junit.Test)

Example 15 with AuthPolicy

use of org.apache.jena.fuseki.auth.AuthPolicy in project jena by apache.

the class TestAuthorized method auth_parse_loggedIn.

@Test
public void auth_parse_loggedIn() {
    Resource r = model.createResource("http://example/rLoggedIn");
    AuthPolicy auth = FusekiConfig.allowedUsers(r);
    assertNotNull(auth);
    assertFalse(auth.isAllowed(null));
    assertTrue(auth.isAllowed("user1"));
    assertTrue(auth.isAllowed("user3"));
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) Resource(org.apache.jena.rdf.model.Resource) Test(org.junit.Test)

Aggregations

AuthPolicy (org.apache.jena.fuseki.auth.AuthPolicy)16 Test (org.junit.Test)10 Resource (org.apache.jena.rdf.model.Resource)5 FusekiConfigException (org.apache.jena.fuseki.FusekiConfigException)3 Collectors.toList (java.util.stream.Collectors.toList)2 FusekiException (org.apache.jena.fuseki.FusekiException)2 AuthPolicyList (org.apache.jena.fuseki.auth.AuthPolicyList)2 DataService (org.apache.jena.fuseki.server.DataService)2 ActionService (org.apache.jena.fuseki.servlets.ActionService)2 Node (org.apache.jena.graph.Node)2 QuerySolution (org.apache.jena.query.QuerySolution)2 ResultSet (org.apache.jena.query.ResultSet)2 Context (org.apache.jena.sparql.util.Context)2 File (java.io.File)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 Method (java.lang.reflect.Method)1 DirectoryStream (java.nio.file.DirectoryStream)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1