minor changes webid
authorHenry Story <henry.story@bblfish.net>
Tue, 18 Oct 2011 11:26:05 +0200
branchwebid
changeset 87 3997a1f9b99a
parent 86 0f5073724842
child 88 de8692b6c5c8
minor changes
src/main/scala/auth/Authz.scala
src/main/scala/auth/WebIdClaim.scala
--- a/src/main/scala/auth/Authz.scala	Tue Oct 18 11:24:07 2011 +0200
+++ b/src/main/scala/auth/Authz.scala	Tue Oct 18 11:26:05 2011 +0200
@@ -84,13 +84,6 @@
 abstract class AuthZ {
   type Req = HttpRequest[HttpServletRequest]
   type Res = ResponseFunction[HttpServletResponse]
-  
-  // I need a guard
-  //   - in order to be able to have different implementations, but subclassing could do to
-  //   - the guard should get the information from the file system or the authdb, so it should know where those are
-
-  // I will need a web cache to get the subject
-
 
   def protect(in: Req=>Res): Req=>Res =  {
       case req @ HttpMethod(method) & Path(path) if guard(method, path).allow(() => subject(req)) => in(req)
@@ -155,7 +148,7 @@
       } yield {
         val initialBinding = new QuerySolutionMap();
         initialBinding.add("res", model.createResource("file://local"+path))
-        val qe: QueryExecution = QueryExecutionFactory.create(selectQuery, model)//, initialBinding)
+        val qe: QueryExecution = QueryExecutionFactory.create(selectQuery, model, initialBinding)
         val agentsAllowed = try {
           val exec = qe.execSelect()
           val res = for (qs <- exec) yield {
--- a/src/main/scala/auth/WebIdClaim.scala	Tue Oct 18 11:24:07 2011 +0200
+++ b/src/main/scala/auth/WebIdClaim.scala	Tue Oct 18 11:26:05 2011 +0200
@@ -46,16 +46,17 @@
       PREFIX rsa: <http://www.w3.org/ns/auth/rsa#>
       SELECT ?m ?e ?mod ?exp
       WHERE {
-       {
-         ?key  cert:identity ?webid .
-       } UNION {
-         ?webid cert:key ?key .
-       }
-        ?key rsa:modulus ?m ;
-             rsa:public_exponent ?e .
+         {
+           ?key  cert:identity ?webid .
+         } UNION {
+           ?webid cert:key ?key .
+         }
+          ?key rsa:modulus ?m ;
+               rsa:public_exponent ?e .
+
        OPTIONAL { ?m cert:hex ?mod . }
        OPTIONAL { ?e cert:decimal ?exp . }
-}""")
+      }""") //Including OPTIONAL notation, for backward compatibility - should remove that after a while
 
   /**
     * Transform an RDF representation of a number into a BigInteger