Search in sources :

Example 16 with AuthPolicy

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

the class TestServiceDataAuthConfig method build.

public static FusekiServer build(int port, AuthPolicy policy) {
    AuthPolicy policy12 = Auth.policyAllowSpecific("user1", "user2");
    AuthPolicy policy13 = Auth.policyAllowSpecific("user1", "user3");
    DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
    DataService.Builder dSrvBuilder = DataService.newBuilder(dsg);
    dSrvBuilder.addEndpoint(Endpoint.create(Operation.Query, null, policy12));
    dSrvBuilder.addEndpoint(Endpoint.create(Operation.Update, null, policy13));
    DataService dSrv = dSrvBuilder.build();
    FusekiServer server = FusekiServer.create().verbose(true).port(port).passwordFile("testing/Access/passwd").add("/db", dSrv).build();
    return server;
}
Also used : AuthPolicy(org.apache.jena.fuseki.auth.AuthPolicy) FusekiServer(org.apache.jena.fuseki.main.FusekiServer) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) DataService(org.apache.jena.fuseki.server.DataService)

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