Class ReadOnlyEval
java.lang.Object
org.apache.jena.permissions.example.readonly.ReadOnlyEval
- All Implemented Interfaces:
SecurityEvaluator
An example of a security evaluator that creates read-only graphs and models.
This evaluator does this by only allowing the Action.READ action, all others
are denied.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.permissions.SecurityEvaluator
SecurityEvaluator.Action, SecurityEvaluator.Util
-
Field Summary
Fields inherited from interface org.apache.jena.permissions.SecurityEvaluator
FUTURE, VARIABLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
evaluate
(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI) Determine if all actions are allowed on the graph.boolean
Determine if all the actions are allowed on the triple within the graph.boolean
evaluate
(Object principal, SecurityEvaluator.Action action, Node graphIRI) Determine if the action is allowed on the graph.boolean
evaluate
(Object principal, SecurityEvaluator.Action action, Node graphIRI, Triple triple) Determine if the action is allowed on the triple within the graph.boolean
evaluateAny
(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI) Determine if any of the actions are allowed on the graph.boolean
evaluateAny
(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI, Triple triple) Determine if any of the actions are allowed on the triple within the graph.boolean
evaluateUpdate
(Object principal, Node graphIRI, Triple from, Triple to) No updated are allowed.We really don't need a system principal so we just create a dummy one.boolean
isPrincipalAuthenticated
(Object principal) Our dummy principal is never authenticated.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jena.permissions.SecurityEvaluator
isHardReadError
-
Constructor Details
-
ReadOnlyEval
public ReadOnlyEval()
-
-
Method Details
-
evaluate
public boolean evaluate(Object principal, SecurityEvaluator.Action action, Node graphIRI) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if the action is allowed on the graph.- Specified by:
evaluate
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.action
- The action to performgraphIRI
- The IRI of the graph to check- Returns:
- true if the action is allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluate
public boolean evaluate(Object principal, SecurityEvaluator.Action action, Node graphIRI, Triple triple) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if the action is allowed on the triple within the graph.The evaluation should be performed in the following order:
- If the triple contains a
VARIABLE
then this method must returntrue
if there are any restrictions where the remaining nodes are either constants orANY
nodes. This will force the system to use subsequent checks to verify access by substituting the value of theVARIABLE
s. If the system can not quickly verify the solution it is always acceptable to returntrue
. - Except as specified in the above check, if the triple contains an
ANY
then this method must returnfalse
if there are any restrictions where the remaining nodes are held constant and the ANY node is allowed to vary. This checks is used to avoid subsequent explicit triple checks. If the system can not quickly verify the solution it is always acceptable to returnfalse
. - All other triples are explicit triples and the system must determine if
the user is permitted to perform the action on the triple. If the triple
contains a
FUTURE
node that node should be considered as an anonymous or blank node that is not yet created. It should only be used withCreate
actions and is asking if the user may create a blank node in that position in the triple.
- Specified by:
evaluate
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.action
- The action to performgraphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.triple
- The triple to check- Returns:
- true if the action is allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
- If the triple contains a
-
evaluate
public boolean evaluate(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if all actions are allowed on the graph.- Specified by:
evaluate
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.actions
- The set of actions to performgraphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.- Returns:
- true if all the actions are allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluate
public boolean evaluate(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI, Triple triple) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if all the actions are allowed on the triple within the graph.See evaluate( Action, Node, Triple ) for discussion of evaluation strategy.
- Specified by:
evaluate
in interfaceSecurityEvaluator
actions
- The actions to perform.graphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.triple
- The triple to check- Returns:
- true if all the actions are allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateAny
public boolean evaluateAny(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if any of the actions are allowed on the graph.- Specified by:
evaluateAny
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.actions
- The actions to performgraphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.- Returns:
- true true if any the actions are allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateAny
public boolean evaluateAny(Object principal, Set<SecurityEvaluator.Action> actions, Node graphIRI, Triple triple) throws AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if any of the actions are allowed on the triple within the graph.See evaluate( Action, Node, Triple ) for discussion of evaluation strategy.
- Specified by:
evaluateAny
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.actions
- The actions to check.graphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.triple
- The triple to check- Returns:
- true if any the actions are allowed, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateUpdate
public boolean evaluateUpdate(Object principal, Node graphIRI, Triple from, Triple to) throws AuthenticationRequiredException No updated are allowed.- Specified by:
evaluateUpdate
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal that is attempting the action.graphIRI
- The IRI of the graph to the action is being taken upon. May beANY
.from
- The triple to be changedto
- The value to change it to.- Returns:
- true if the user may make the change, false otherwise.
- Throws:
AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
getPrincipal
We really don't need a system principal so we just create a dummy one.- Specified by:
getPrincipal
in interfaceSecurityEvaluator
- Returns:
- The current principal
-
isPrincipalAuthenticated
Our dummy principal is never authenticated.- Specified by:
isPrincipalAuthenticated
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal to check.- Returns:
- true if authenticated, false if not.
-