Module org.apache.jena.permissions
Package org.apache.jena.permissions.impl
Class CachedSecurityEvaluator
java.lang.Object
org.apache.jena.permissions.impl.CachedSecurityEvaluator
- All Implemented Interfaces:
SecurityEvaluator
A SecurityEvaluator that can be cached for later use.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
evaluate
(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI) Determine if all actions are allowed on the graph.boolean
evaluate
(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) Determine if all the actions are allowed on the triple within the graph.boolean
evaluate
(Object principal, SecurityEvaluator.Action action, org.apache.jena.graph.Node graphIRI) Determine if the action is allowed on the graph.boolean
evaluate
(Object principal, SecurityEvaluator.Action action, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) Determine if the action is allowed on the triple within the graph.boolean
evaluateAny
(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI) Determine if any of the actions are allowed on the graph.boolean
evaluateAny
(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) Determine if any of the actions are allowed on the triple within the graph.boolean
evaluateUpdate
(Object principal, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple from, org.apache.jena.graph.Triple to) Determine if the user is allowed to update the "from" triple to the "to" triple.returns the current principal or null if there is no current principal.boolean
isPrincipalAuthenticated
(Object principal) Returns true if the principal is recognized as an authenticated principal by the underlying authentication mechanism.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
-
CachedSecurityEvaluator
- Parameters:
wrapped
-runAs
-
-
-
Method Details
-
evaluate
public boolean evaluate(Object principal, SecurityEvaluator.Action action, org.apache.jena.graph.Node graphIRI) throws org.apache.jena.shared.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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluate
public boolean evaluate(Object principal, SecurityEvaluator.Action action, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) throws org.apache.jena.shared.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:
org.apache.jena.shared.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, org.apache.jena.graph.Node graphIRI) throws org.apache.jena.shared.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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluate
public boolean evaluate(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) throws org.apache.jena.shared.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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateAny
public boolean evaluateAny(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI) throws org.apache.jena.shared.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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateAny
public boolean evaluateAny(Object principal, Set<SecurityEvaluator.Action> actions, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple triple) throws org.apache.jena.shared.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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
evaluateUpdate
public boolean evaluateUpdate(Object principal, org.apache.jena.graph.Node graphIRI, org.apache.jena.graph.Triple from, org.apache.jena.graph.Triple to) throws org.apache.jena.shared.AuthenticationRequiredException Description copied from interface:SecurityEvaluator
Determine if the user is allowed to update the "from" triple to the "to" triple.Update is a special case since it modifies one triple to be another. So the user must have permissions to change the "from" triple into the "to" triple.
- 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:
org.apache.jena.shared.AuthenticationRequiredException
- if user is not authenticated and is required to be.
-
getPrincipal
Description copied from interface:SecurityEvaluator
returns the current principal or null if there is no current principal. All security evaluation methods use this method to determine who the call is being executed as. This allows subsystems (like the listener system) to capture the current user and evaluate later calls in terms of that user.- Specified by:
getPrincipal
in interfaceSecurityEvaluator
- Returns:
- The current principal
-
isPrincipalAuthenticated
Description copied from interface:SecurityEvaluator
Returns true if the principal is recognized as an authenticated principal by the underlying authentication mechanism. This is to handle the case where an authentication mechanism returns a non-null object to indicate a non-authenticated principal. (e.g. Shiro). The principal is guaranteed to have been the return value from an earlier getPrincipal() call.- Specified by:
isPrincipalAuthenticated
in interfaceSecurityEvaluator
- Parameters:
principal
- The principal to check.- Returns:
- true if authenticated, false if not.
-