jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r937566 - in /websites/staging/jena/trunk/content: ./ documentation/security/assembler.html documentation/security/evaluator.html documentation/security/index.html
Date Sat, 24 Jan 2015 21:44:24 GMT
Author: buildbot
Date: Sat Jan 24 21:44:23 2015
New Revision: 937566

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/security/assembler.html
    websites/staging/jena/trunk/content/documentation/security/evaluator.html
    websites/staging/jena/trunk/content/documentation/security/index.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Jan 24 21:44:23 2015
@@ -1 +1 @@
-1653226
+1654582

Modified: websites/staging/jena/trunk/content/documentation/security/assembler.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/security/assembler.html (original)
+++ websites/staging/jena/trunk/content/documentation/security/assembler.html Sat Jan 24 21:44:23 2015
@@ -142,28 +142,53 @@
 	<div class="col-md-12">
 	<div id="breadcrumbs"></div>
 	<h1 class="title">Jena Security - Assembler For a Secured Model</h1>
-  <p>Jena Security provides a standard Jena assembler making it easy to use the SecuredModel in an Assembler based 
-environment.  To use the security assembler the assembler file must contain the lines:</p>
-<div class="codehilite"><pre><span class="o">&lt;&gt;</span><span class="p">;</span> <span class="n">ja</span><span class="p">:</span><span class="n">loadClass</span> &quot;<span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">jena</span><span class="p">.</span><span class="n">security</span><span class="p">.</span><span class="n">SecuredAssembler</span>&quot; <span class="p">.</span>
-<span class="nb">sec</span><span class="p">:</span><span class="n">Model</span> <span class="n">rdfs</span><span class="p">:</span><span class="n">subClassOf</span> <span class="n">ja</span><span class="p">:</span><span class="n">NamedModel</span> <span class="p">.</span>
+  <p>Jena Security provides a standard Jena assembler making it easy to use the <code>SecuredModel</code> in an Assembler based environment.  To use the security assembler the assembler file must contain the lines:</p>
+<div class="codehilite"><pre><span class="p">[]</span> <span class="n">ja</span><span class="p">:</span><span class="n">loadClass</span>    &quot;<span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">jena</span><span class="p">.</span><span class="n">security</span><span class="p">.</span><span class="n">SecuredAssembler</span>&quot; <span class="p">.</span>
+ <span class="nb">sec</span><span class="p">:</span><span class="n">Model</span>       <span class="n">rdfs</span><span class="p">:</span><span class="n">subClassOf</span>  <span class="n">ja</span><span class="p">:</span><span class="n">NamedModel</span> <span class="p">.</span>
 </pre></div>
 
 
-<p>and a model definition something like:</p>
-<div class="codehilite"><pre><span class="p">[]</span> <span class="n">a</span> <span class="n">ja</span><span class="p">:</span><span class="n">Model</span> <span class="p">;</span>
-   <span class="nb">sec</span><span class="p">:</span><span class="n">baseModel</span> <span class="n">jena</span><span class="p">:</span><span class="n">model</span> <span class="p">;</span>
-   <span class="n">ja</span><span class="p">:</span><span class="n">modelName</span> &quot;<span class="n">modelName</span>&quot;<span class="p">;</span>
-   <span class="nb">sec</span><span class="p">:</span><span class="n">evaluatorFactory</span> &quot;<span class="n">javaclass</span>&quot;<span class="p">;</span>
-   <span class="p">.</span>
+<p>The secured assembler provides XXXXXXXXXXXx properties for the assembler files.</p>
+<p>Assuming we define</p>
+<div class="codehilite"><pre> <span class="p">@</span><span class="n">prefix</span> <span class="nb">sec</span><span class="p">:</span>    <span class="o">&lt;</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">apache</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="n">jena</span><span class="o">/</span><span class="n">security</span><span class="o">/</span><span class="n">Assembler</span>#<span class="o">&gt;</span> <span class="p">.</span>
 </pre></div>
 
 
-<p>where:
-- <code>jena:model</code> is a model defined in the assembler file.  In this example there would be a like in the file
-something like <code>jena:model a ja:Model</code>.<br />
-- <code>modelName</code> is the name of the model as identified in the security manager.
-- <code>javaclass</code> is the java class name that implements an Evaluator Factory.  The Factory must have static method 
-<code>getInstance()</code> that returns a SecurityEvaluator instance.</p>
+<p>Then the following resources are defined</p>
+<p><code>sec:Model</code> - A secured model.  One against which the security evaluator is running access checks.  All sec:Model instances must have a ja:ModelName to identify it to the <code>SecurityEvaluator</code></p>
+<p><code>sec:Evaluator</code> -  An instance of <code>SecurityEvaluator</code>.</p>
+<p>The following are properties are also defined:</p>
+<p><code>sec:evaluatorFactory</code> - Identifies the class name of a factory class that implements a no-argument <code>getInstance()</code> method that returns an instance of <code>SecurityEvaluator</code>.</p>
+<p><code>sec:baseModel</code> - Identifies the ja:Model that is to have security applied to it.</p>
+<p><code>sec:evaluatorImpl</code> - Identifies an instance of <code>SecurityEvaluator</code>.</p>
+<p><code>sec:evaluatorClass</code> - Identifies a class that implements <code>SecurityEvaluator</code></p>
+<p><code>sec:args</code> - Identifies arguments to the sec:evaluatorClass constructor.</p>
+<p>The secured assembler provides two (2) mechanisms to create a secured graph.  The first is to use a <code>SecurityEvaluator</code> factory</p>
+<div class="codehilite"><pre><span class="n">my</span><span class="o">:</span><span class="n">securedModel</span> <span class="n">rdf</span><span class="o">:</span><span class="n">type</span> <span class="n">sec</span><span class="o">:</span><span class="n">Model</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">baseModel</span> <span class="n">my</span><span class="o">:</span><span class="n">baseModel</span> <span class="o">;</span>
+    <span class="n">ja</span><span class="o">:</span><span class="n">modelName</span> <span class="s2">&quot;https://example.org/securedBaseModel&quot;</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">evaluatorFactory</span> <span class="s2">&quot;the.evaluator.factory.class.name&quot;</span> <span class="o">.</span>
+</pre></div>
+
+
+<p>In the above example static method <code>getInstance()</code> is called on the.evaluator.factory.class.name and the result is used as the SecurityEvaluator.  This is used to create a secured model (<code>my:securedModel</code>) that wraps the model  <code>my:baseModel</code> and identifies itself to the <code>SecurityEvaluator</code> with the URI <code>"https://example.org/securedBaseModel"</code>. </p>
+<p>The second mechanism is to use the <code>sec:Evaluator</code> method.</p>
+<div class="codehilite"><pre><span class="n">my</span><span class="o">:</span><span class="n">secEvaluator</span> <span class="n">rdf</span><span class="o">:</span><span class="n">type</span> <span class="n">sec</span><span class="o">:</span><span class="n">Evaluator</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">args</span> <span class="o">[</span>  
+        <span class="n">rdf</span><span class="o">:</span><span class="n">_1</span> <span class="n">my</span><span class="o">:</span><span class="n">secInfoModel</span> <span class="o">;</span>
+    <span class="o">]</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">evaluatorClass</span>    <span class="s2">&quot;your.implementation.SecurityEvaluator&quot;</span> 
+<span class="o">.</span>
+
+<span class="n">my</span><span class="o">:</span><span class="n">securedModel</span> <span class="n">rdf</span><span class="o">:</span><span class="n">type</span> <span class="n">sec</span><span class="o">:</span><span class="n">Model</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">baseModel</span> <span class="n">my</span><span class="o">:</span><span class="n">baseModel</span> <span class="o">;</span>
+    <span class="n">ja</span><span class="o">:</span><span class="n">modelName</span> <span class="s2">&quot;https://example.org/securedBaseModel&quot;</span> <span class="o">;</span>
+    <span class="n">sec</span><span class="o">:</span><span class="n">evaluatorImpl</span>  <span class="n">my</span><span class="o">:</span><span class="n">secEvaluator</span> <span class="o">.</span>
+</pre></div>
+
+
+<p>In the above example <code>my:secEvaluator</code> is defined as a <code>sec:Evaluator</code> implemented by the class <code>"your.implementation.SecurityEvaluator"</code>.  When the instance is constructed the constructor with one (1) argument is used and it is passed <code>my:secInfoModel</code> as an argument.  <code>my:secInfoModel</code> may be any type supported by the assembler.  If more than one argument is desired then <code>rdf:_2</code>, <code>rdf:_3</code>, <code>rdf:_4</code>, etc. may be added to the <code>sec:args</code> list.  The  <code>"your.implementation.SecurityEvaluator"</code> with the proper number of arguments will be called.  It is an error to have more than one argument with the proper number of arguments.  </p>
+<p>After constructon the value of <code>my:securedModel</code> is used to construct the <code>my:securedModel</code> instance.  This has the same properties as the previous example other than that the <code>SecurityEvaluator</code> instance is different.</p>
   </div>
 </div>
 

Modified: websites/staging/jena/trunk/content/documentation/security/evaluator.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/security/evaluator.html (original)
+++ websites/staging/jena/trunk/content/documentation/security/evaluator.html Sat Jan 24 21:44:23 2015
@@ -174,46 +174,46 @@ triple:</p>
 <li><code>SecTriple.ANY</code> = new SecTriple(SecNode.ANY, SeccNode.ANY, SecNode.ANY)` Matches any SecTriple.</li>
 </ul>
 <h3 id="evaluator-methods">Evaluator Methods</h3>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if the action is permitted within the graph.</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if the action is allowed on the triple within the graph.</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if all actions are allowed on the graph.</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if all the actions are allowed on the triple within the graph.            </p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if any of the actions are allowed on the graph.</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if any of the actions are allowed on the triple within the graph.</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateUpdate</span><span class="p">(</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">from</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">to</span> <span class="p">);</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateUpdate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">from</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">to</span> <span class="p">);</span>
 </pre></div>
 
 
 <p>Determine if the user is allowed to update the "from" triple to the "to" triple.            </p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">Principal</span> <span class="n">getPrincipal</span><span class="p">();</span>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">Object</span> <span class="n">getPrincipal</span><span class="p">();</span>
 </pre></div>
 
 
-<p>returns the current principal or null if there is no current principal.    </p>
+<p>Returns the current principal or null if there is no current principal.    </p>
 <h2 id="sample-implementation">Sample Implementation</h2>
 <p>This sample is for a graph that contains a set of messages, access to the messages are limited to 
 principals that the messages are to or from.  Any triple that is not a message is not affected. This 
@@ -221,6 +221,7 @@ implementation simply has a <code>setPri
 user principal or name from the authentication system.  This implementation also requires access to the underlying
 model to determine if the user has access, however, that is not a requirement of the SecurityEvaluator in general.
 Determining access from the information provided is an exercise for the implementer. </p>
+<p>See the example jar for another implementation example.</p>
 <!-- language: lang-java -->
 
 <div class="codehilite"><pre><span class="n">public</span> <span class="n">class</span> <span class="n">ExampleEvaluator</span> <span class="n">implements</span> <span class="n">SecurityEvaluator</span> <span class="p">{</span>
@@ -241,13 +242,14 @@ Determining access from the information
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
         <span class="o">//</span> <span class="n">we</span> <span class="n">allow</span> <span class="n">any</span> <span class="n">action</span> <span class="n">on</span> <span class="n">a</span> <span class="n">graph</span><span class="p">.</span>
         <span class="k">return</span> <span class="n">true</span><span class="p">;</span>
     <span class="p">}</span>
 
-    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Resource</span> <span class="n">r</span> <span class="p">)</span>
+    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principalObj</span><span class="p">,</span> <span class="n">Resource</span> <span class="n">r</span> <span class="p">)</span>
     <span class="p">{</span>
+        <span class="n">Principal</span> <span class="n">principal</span> <span class="p">=</span> <span class="p">(</span><span class="n">Principal</span><span class="p">)</span><span class="n">principalObj</span><span class="p">;</span>
         <span class="o">//</span> <span class="n">a</span> <span class="n">message</span> <span class="n">is</span> <span class="n">only</span> <span class="n">available</span> <span class="n">to</span> <span class="n">sender</span> <span class="n">or</span> <span class="n">recipient</span>
         <span class="k">if</span> <span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">hasProperty</span><span class="p">(</span> <span class="n">RDF</span><span class="p">.</span><span class="n">type</span><span class="p">,</span> <span class="n">msgType</span> <span class="p">))</span>
         <span class="p">{</span>
@@ -257,7 +259,7 @@ Determining access from the information
         <span class="k">return</span> <span class="n">true</span><span class="p">;</span>    
     <span class="p">}</span>
 
-    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">SecNode</span> <span class="n">node</span> <span class="p">)</span>
+    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">node</span> <span class="p">)</span>
     <span class="p">{</span>
         <span class="k">if</span> <span class="p">(</span><span class="n">node</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">ANY</span> <span class="p">))</span> <span class="p">{</span>
             <span class="k">return</span> <span class="n">false</span><span class="p">;</span>  <span class="o">//</span> <span class="n">all</span> <span class="n">wild</span> <span class="n">cards</span> <span class="n">are</span> <span class="n">false</span>
@@ -265,11 +267,11 @@ Determining access from the information
 
         <span class="k">if</span> <span class="p">(</span><span class="n">node</span><span class="p">.</span><span class="n">getType</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">Type</span><span class="p">.</span><span class="n">URI</span><span class="p">))</span> <span class="p">{</span>
             <span class="n">Resource</span> <span class="n">r</span> <span class="p">=</span> <span class="n">model</span><span class="p">.</span><span class="n">createResource</span><span class="p">(</span> <span class="n">node</span><span class="p">.</span><span class="n">getValue</span><span class="p">()</span> <span class="p">);</span>
-            <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">r</span> <span class="p">);</span>
+            <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">r</span> <span class="p">);</span>
         <span class="p">}</span>
         <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">node</span><span class="p">.</span><span class="n">getType</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">Type</span><span class="p">.</span><span class="n">Anonymous</span><span class="p">))</span> <span class="p">{</span>
             <span class="n">Resource</span> <span class="n">r</span> <span class="p">=</span> <span class="n">model</span><span class="p">.</span><span class="n">getRDFNode</span><span class="p">(</span> <span class="n">NodeFactory</span><span class="p">.</span><span class="n">createAnon</span><span class="p">(</span> <span class="n">new</span> <span class="n">AnonId</span><span class="p">(</span> <span class="n">node</span><span class="p">.</span><span class="n">getValue</span><span class="p">())</span> <span class="p">)</span> <span class="p">).</span><span class="n">asResource</span><span class="p">();</span>
-            <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">r</span> <span class="p">);</span>
+            <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">r</span> <span class="p">);</span>
         <span class="p">}</span>
         <span class="k">else</span>
         <span class="p">{</span>
@@ -278,42 +280,42 @@ Determining access from the information
 
     <span class="p">}</span>
 
-    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span><span class="p">.</span><span class="n">getSubject</span><span class="p">())</span> <span class="o">&amp;&amp;</span>
-                <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span><span class="p">.</span><span class="n">getObject</span><span class="p">())</span> <span class="o">&amp;&amp;</span>
-                <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span><span class="p">.</span><span class="n">getPredicate</span><span class="p">());</span>
+    <span class="n">private</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">)</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span><span class="p">.</span><span class="n">getSubject</span><span class="p">())</span> <span class="o">&amp;&amp;</span>
+                <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span><span class="p">.</span><span class="n">getObject</span><span class="p">())</span> <span class="o">&amp;&amp;</span>
+                <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span><span class="p">.</span><span class="n">getPredicate</span><span class="p">());</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span><span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span> <span class="p">);</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span><span class="p">)</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span> <span class="p">);</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
         <span class="k">return</span> <span class="n">true</span><span class="p">;</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluate</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span>
             <span class="n">SecTriple</span> <span class="n">triple</span><span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span> <span class="p">);</span>
+        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span> <span class="p">);</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span><span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">)</span> <span class="p">{</span>
         <span class="k">return</span> <span class="n">true</span><span class="p">;</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span><span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateAny</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">Action</span><span class="o">&gt;</span> <span class="n">actions</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span>
             <span class="n">SecTriple</span> <span class="n">triple</span><span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">triple</span> <span class="p">);</span>
+        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">triple</span> <span class="p">);</span>
     <span class="p">}</span>
 
     <span class="p">@</span><span class="n">Override</span>
-    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateUpdate</span><span class="p">(</span><span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">from</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">to</span><span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">from</span> <span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">to</span> <span class="p">);</span>
+    <span class="n">public</span> <span class="n">boolean</span> <span class="n">evaluateUpdate</span><span class="p">(</span><span class="n">Object</span> <span class="n">principal</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">from</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">to</span><span class="p">)</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">from</span> <span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">evaluate</span><span class="p">(</span> <span class="n">principal</span><span class="p">,</span> <span class="n">to</span> <span class="p">);</span>
     <span class="p">}</span>
 
     <span class="n">public</span> <span class="n">void</span> <span class="n">setPrincipal</span><span class="p">(</span> <span class="n">String</span> <span class="n">userName</span> <span class="p">)</span>

Modified: websites/staging/jena/trunk/content/documentation/security/index.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/security/index.html (original)
+++ websites/staging/jena/trunk/content/documentation/security/index.html Sat Jan 24 21:44:23 2015
@@ -149,7 +149,7 @@ framework for developers or integrators
 <ul>
 <li><a href="#overview">Overview</a></li>
 <li><a href="#usage-notes">Usage Notes</a></li>
-<li><a href="#how-it-works">How it Works</a></li>
+<li><a href="design.html">Jena Security Design</a></li>
 <li><a href="evaluator.html">Security Evaluator</a></li>
 <li><a href="assembler.html">Assembler</a></li>
 </ul>
@@ -165,6 +165,7 @@ SecurityEvaluator the developer may appl
 optionally triples within the graphs. </p>
 <p>The javadocs have additional annotations that specify what permissions at graph and triple levels are required for 
 the user to execute the method.</p>
+<p>There is an example jar that contains configuration examples for both a stand alone application and a fuseki configuration option.</p>
 <h2 id="usage-notes">Usage Notes</h2>
 <p>When the system is correctly configured the developer creates a SecuredGraph by calling 
 <code>Factory.getInstance( SecurityEvaluator, String, Graph );</code>. Once created the resulting graph automatically 
@@ -183,115 +184,6 @@ permissions, not the <strong>update</str
 the result is a tighter security definition than was requested. For simplicity sake we recommend that the wrapped 
 secured graph only be used in cases where access to the graph as a whole is granted/denied. In these cases the user 
 either has all CRUD capabilities or none.</p>
-<h2 id="how-it-works">How it Works</h2>
-<p>Jena-security does not specify how to determine who the user is, just that a Principal identifying the user is 
-available. It does not specify how to determine what the user has access to.</p>
-<p>It does require that a developer or integrator implement the SecurityEvaluator so that when the 
-system asks if the current user can perform an action (say read graph X) there is a yes or no answer.</p>
-<p>The framework does all the work of intercepting the calls to the graph (or model) and making appropriate calls 
-to the Evaluator before allowing the call to go ahead.  There are numerous unit tests to ensure that
-this is done correctly.  The required permissions are specified in the javadoc for object classes 
-(e.g. SecuredGraph, SecuredModel).</p>
-<p>Conceptually the framework implements 2 levels of security: graph and triple.</p>
-<p>The graph restrictions are applied before triple restrictions.  So the system will call </p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span> <span class="p">);</span>
-</pre></div>
-
-
-<p>to ask can the current user "Read" (Action)  graph X (graphIRI)  as <code>evaluate( Action.READ, X )</code>.</p>
-<p>if the answer is yes then the system will call</p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
-</pre></div>
-
-
-<p>to ask if the current user can "Read" (Action) from graph X (graphIRI) all triples (SecTriple) as 
-<code>evaluate( Action.READ, X, SecTriple.ALL )</code>.</p>
-<p>if the answer is yes then the system will execute the call, if the answer is no then for each 
-potential triple the user might read the system will call</p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span> <span class="n">action</span><span class="p">,</span> <span class="n">SecNode</span> <span class="n">graphIRI</span><span class="p">,</span> <span class="n">SecTriple</span> <span class="n">triple</span> <span class="p">);</span>
-</pre></div>
-
-
-<p>to ask if the current user can "Read" (Action) from graph X (graphIRI) the triple in question 
-(<triple>) as <code>evaluate( Action.READ, X, &lt;triple&gt; )</code>.</p>
-<p>Jena-security performs similar checks for all creates, reads, updates and deletes. (CRUD).  It also does this 
-for all classes that can be returned from the secured classes.  For example an RDFList returned 
-from a SecuredModel is secured so that the filtering above is performed against the items in the 
-list.</p>
-<h3 id="use-of-special-nodes">Use of special nodes</h3>
-<p>Jena-security provides three special nodes to facilitate evaluation of security policy constraints.</p>
-<h4 id="secnodeany">SecNode.ANY</h4>
-<p>This is similar to the Jena <code>Node.ANY</code> node.  It matches any node.  In general the system will ask if 
-the user can access a graph by executing </p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span><span class="p">,</span> <span class="n">GraphIRI</span> <span class="p">)</span>
-</pre></div>
-
-
-<p>if the user can access the graph then the system will execute</p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span><span class="p">,</span> <span class="n">GraphIRI</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">SecNode</span><span class="p">.</span><span class="n">ANY</span><span class="p">,</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">ANY</span><span class="p">,</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">ANY</span><span class="o">&gt;</span> <span class="p">)</span>
-</pre></div>
-
-
-<p>to determine if the user can perform the action on all triples.  If not then the system will attempt to 
-determine if the user perform the action on each specific triple.  In some cases the system can determine that
-the range of nodes involved in the action a sub set of all nodes and will call <code>evaluate</code> with some constant 
-nodes.</p>
-<ul>
-<li>
-<p><code>&lt;SecNode.ANY, SecNode.ANY, SecNode.ANY&gt;</code> - Asks if the user may perform the action on any triple. </p>
-</li>
-<li>
-<p><code>&lt;X, SecNode.ANY, SecNode.ANY&gt;</code> - Asks if the user may perform the action against
-any triple where X is the subject.</p>
-</li>
-<li>
-<p><code>&lt;SecNode.ANY, X, SecNode.ANY&gt;</code> - Asks if the user may perform the action against
-any triple where X is the predicate.</p>
-</li>
-<li>
-<p><code>&lt;SecNode.ANY, SecNode.ANY, SecNode.X&gt;</code> - Asks if if the user may perform the action against
-any triple where X is the object.</p>
-</li>
-</ul>
-<p>The <code>SecNode.ANY</code> node may occur multiple times and may occur with the <code>SecNode.VARIABLE</code> and/or 
- <code>SecNode.FUTURE</code> nodes.</p>
-<h4 id="secnodevariable">SecNode.VARIABLE</h4>
-<p>This differs from <code>SecNode.ANY</code> in that the system is asking "if there are any prohibitions" not "if the user 
-may perform". Thus queries with the <code>SecNode.VARIABLE</code> nodes should return <code>true</code> where <code>SecNode.ANY</code> returns
-<code>false</code>.  In general this type is used in the query to determine if triple level filtering of results must be 
-performed.</p>
-<ul>
-<li>
-<p><code>&lt;SecNode.VARIABLE, X, Y&gt;</code> - Asks if there are any prohibitions against the user seeing all subjects
-that have property X and object Y.</p>
-</li>
-<li>
-<p><code>&lt;X, SecNode.VARIABLE, Y&gt;</code> - Asks if there are any prohibitions against the user seeing all predicates
-hat have subject X and object Y.</p>
-</li>
-<li>
-<p><code>&lt;X, Y, SecNode.VARIABLE&gt;</code> - Asks if there are any prohibitions against the user seeing all objects
-that have subject X and predicate Y.</p>
-</li>
-</ul>
-<p>The <code>SecNode.VARIABLE</code> may occur multiple times and may occur with the <code>SecNode.ANY</code> node.</p>
-<h4 id="secnodefuture">SecNode.FUTURE</h4>
-<p>Insertions pose a different set of problems in that in some cases the system does not know what value will be 
-inserted.  For example when concatenating one RDFList with another (<code>rdfList.concatenate( rdfList2 )</code>) the system
-will create a series of anonymous nodes.  To check for these the <code>SecNode.FUTURE</code> is used. Initially the system will
-call </p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span><span class="p">.</span><span class="n">CREATE</span><span class="p">,</span> <span class="n">X</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">SecNode</span><span class="p">.</span><span class="n">FUTURE</span><span class="p">,</span> <span class="n">RDF</span><span class="p">.</span><span class="n">first</span><span class="p">,</span> <span class="n">SecNode</span><span class="p">.</span><span class="n">ANY</span><span class="o">&gt;</span> <span class="p">)</span>
-</pre></div>
-
-
-<p>to ascertain if the user can create a triple in graph X that has an anonymous node (SecNode.FUTURE) as the subject,
-RDF.first as the predicate and any node as the object.  If this is not allowed then for every node in <code>rdfList2</code> 
-the system will call</p>
-<div class="codehilite"><pre><span class="n">evaluate</span><span class="p">(</span> <span class="n">Action</span><span class="p">.</span><span class="n">CREATE</span><span class="p">,</span> <span class="n">X</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">SecNode</span><span class="p">.</span><span class="n">FUTURE</span><span class="p">,</span> <span class="n">RDF</span><span class="p">.</span><span class="n">first</span><span class="p">,</span> <span class="n">node</span><span class="o">&gt;</span> <span class="p">)</span>
-</pre></div>
-
-
-<p>where <code>node</code> is the node from <code>rdfList2</code> to be added.</p>
   </div>
 </div>
 



Mime
View raw message