jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/6] jena git commit: JENA-1623: Endpoint access control lists
Date Thu, 22 Nov 2018 11:51:33 GMT
Repository: jena
Updated Branches:
  refs/heads/master df9b41df5 -> 35c1c3655


http://git-wip-us.apache.org/repos/asf/jena/blob/ca783936/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestAuthorizedRequest.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestAuthorizedRequest.java
b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestAuthorizedRequest.java
deleted file mode 100644
index 00a5e37..0000000
--- a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestAuthorizedRequest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.main.access;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.jena.fuseki.build.FusekiBuilder;
-import org.apache.jena.fuseki.build.RequestAuthorization;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.riot.RDFDataMgr;
-import org.junit.Test;
-
-public class TestAuthorizedRequest {
-    
-    static Model model = RDFDataMgr.loadModel("testing/Access/allowedUsers.ttl");
-    
-    @Test public void authrequest_anon() {
-        RequestAuthorization req = RequestAuthorization.policyAllowAnon();
-        assertTrue(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-    }
-    
-    @Test public void authrequest_anyLoggedIn_1() {
-        RequestAuthorization req = RequestAuthorization.policyAllowAuthenticated();
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-    }
-    
-    @Test public void authrequest_anyLoggedIn_2() {
-        RequestAuthorization req = RequestAuthorization.policyAllowSpecific("*");
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-    }
-
-    @Test public void authrequest_noOne() {
-        RequestAuthorization req = RequestAuthorization.policyNoAccess();
-        assertFalse(req.isAllowed(null));
-        assertFalse(req.isAllowed("user1"));
-    }
-
-
-    @Test public void authrequest_user_1() {
-        RequestAuthorization req = RequestAuthorization.policyAllowSpecific("user1", "user2");
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-        assertTrue(req.isAllowed("user2"));
-        assertFalse(req.isAllowed("user3"));
-    }
-    
-    @Test public void authrequest_parse_no_info_1() {
-        Resource r = model.createResource("http://example/notInData");
-        RequestAuthorization req = FusekiBuilder.allowedUsers(r);
-        assertNull(req);
-    }
-
-    @Test public void authrequest_parse_no_info_2() {
-        Resource r = model.createResource("http://example/none");
-        RequestAuthorization req = FusekiBuilder.allowedUsers(r);
-        assertNull(req);
-    }
-
-    @Test public void authrequest_parse_1() {
-        Resource r = model.createResource("http://example/r1");
-        RequestAuthorization req = FusekiBuilder.allowedUsers(r);
-        assertNotNull(req);
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-        assertTrue(req.isAllowed("user2"));
-        assertFalse(req.isAllowed("user3"));
-    }
-    
-    @Test public void authrequest_parse_2() {
-        Resource r = model.createResource("http://example/r2");
-        RequestAuthorization req = FusekiBuilder.allowedUsers(r);
-        assertNotNull(req);
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-        assertTrue(req.isAllowed("user2"));
-        assertFalse(req.isAllowed("user3"));
-    }
-    
-    @Test public void authrequest_parse_loggedIn() {
-        Resource r = model.createResource("http://example/rLoggedIn");
-        RequestAuthorization req = FusekiBuilder.allowedUsers(r);
-        assertNotNull(req);
-        assertFalse(req.isAllowed(null));
-        assertTrue(req.isAllowed("user1"));
-        assertTrue(req.isAllowed("user3"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/ca783936/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestPasswordServices.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestPasswordServices.java
b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestPasswordServices.java
index 0b1e4cf..dc0ff32 100644
--- a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestPasswordServices.java
+++ b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/access/TestPasswordServices.java
@@ -27,8 +27,9 @@ import org.apache.jena.atlas.logging.LogCtl;
 import org.apache.jena.atlas.web.HttpException;
 import org.apache.jena.atlas.web.TypedInputStream;
 import org.apache.jena.atlas.web.WebLib;
+import org.apache.jena.fuseki.auth.Auth;
+import org.apache.jena.fuseki.auth.AuthPolicy;
 import org.apache.jena.fuseki.build.FusekiBuilder;
-import org.apache.jena.fuseki.build.RequestAuthorization;
 import org.apache.jena.fuseki.jetty.JettyLib;
 import org.apache.jena.fuseki.main.FusekiServer;
 import org.apache.jena.fuseki.server.DataService;
@@ -94,8 +95,8 @@ public class TestPasswordServices {
         
         DataService dSrv = new DataService(DatasetGraphFactory.createTxnMem());
         FusekiBuilder.populateStdServices(dSrv, false);
-        RequestAuthorization reqAuth = RequestAuthorization.policyAllowSpecific("user1");
-        dSrv.setAllowedUsers(reqAuth);
+        AuthPolicy reqAuth = Auth.policyAllowSpecific("user1");
+        dSrv.setAuthPolicy(reqAuth);
         
         fusekiServer =
             FusekiServer.create()

http://git-wip-us.apache.org/repos/asf/jena/blob/ca783936/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-webapp/fuseki-dev b/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
index 365a33a..6399b8e 100755
--- a/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
+++ b/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
@@ -58,7 +58,7 @@ then
 fi
 
 # Prepend any development directories here
-DEVDIRS="jena-core jena-tdb jena-arq jena-text"
+DEVDIRS="jena-core jena-tdb jena-arq jena-text jena-fuseki2/jena-fuseki-core jena-fuseki2/jena-fuseki-webapp"
 for X in $DEVDIRS
 do
     CPX="$FUSEKI_HOME/../../$X/target/classes"


Mime
View raw message