Securing your Data

Search XAP 7.0
Searching XAP 7.0.X Documentation
Browse XAP 7.0
Offline Documentation

Download latest offline documentation in HTML format:
xap-7.0.2-documentation.zip (12.3MB)

                                                              

Summary: Securing Embedded Space, Processing Unit, Local Cache/View, Space Filters, Custom Access Control, Custom Access Control, Task Execution/Executors, Event Driven Remoting, JDBC

Embedded Space

There are a couple of ways to create a secured embedded Space (standalone or part of a Processing Unit). Access (to data) is granted only to users with sufficient privileges.

Processing Unit

Configuring Processing Unit Elements, Configuring the Space

A processing unit by itself is not secured. It inherits its security from the managing GSM and GSC.
But, a processing unit may have an embedded Space which may be secured (if required), to protect access to data.

Processing Unit XML

Processing Unit Deployment

The pu.properties file supplied during deployment may contain the username and password. If these are supplied, they will be used to implicitly create a secured Space, with security privileges being propagated to internal services.

#pu.properties
security.username=user
security.password=password

Of course, having the username and password exposed (in pu.xml/pu.properties) isn't that "secure". A preferred usage would be to supply the credentials during deployment. The UI, CLI and Admin API provide a comprehensive support for deploying a secured processing unit.

Local Cache

Local Cache

The local cache is a read-only service on top of a remote Space. Thus, the local cache "creator" needs to have Read privileges.
Security is enforced by the remote Space, and the proxy should be acquired by supplying the username and password.

Local View

Local View

Similar to a Local Cache, the Local View is a read-only service on top of a remote Space. Here, the cache is limited to Views. Thus, the local view "creator" needs to have Read privileges for the specific views. For example, needs to have Read privileges for both Trade and Stock classes, otherwise access will be denied.

Space Filters

OpenSpaces Space Filter support, ISpaceFilters

Filters are interceptors inside the GigaSpaces Space which allow implementation of user-defined logic based on Space events. Some filters need to perform operations on the embedded Space. If secured, the filter needs to have sufficient privileges for its operations.

The username and password supplied when creating a Space, will be used to implicitly create a secured Space. The security privileges of the specified user will be propagated to the Filter. If the user has Read privileges, then the filter will be able to perform a space.read(..) on its embedded Space.

Before Authentication operation

A filter can be registered for before-authentication events. Before a client tries to authenticate, any filter with the before-authentication operation-code will be invoked. The SpaceContext supplied as part of the call holds a SecurityContext that has the UserDetails object.

Custom Access Control

Custom Access Control is available from 7.0.2
Custom Access control using Space Filters allows for access decisions based on user/role/data relationships. The SpaceContext filter invocation parameter holds the SecurityContext of the current operation. This context provides you with UserDetails, the Authentication and AuditDetails. Based on these, you can enforce custom access decisions.

Note that the SpaceContext may be null in cases related to replication/recovery and filter operations such as "notify-trigger". In these cases, there is no user context.

The filter can be declared just like any other filter, but note that the priority plays a role in the order of filter execution. Default priority is zero.

<bean id="customAccessControlFilter" class="example.CustomAccessControlFilter" />

<os-core:space id="space" url="/./space">
	<os-core:security secured="true"/>
	<os-core:annotation-adapter-filter priority="0">
		<os-core:filter ref="customAccessControlFilter" />
	</os-core:annotation-adapter-filter>
</os-core:space>

Usage examples:

Task Execution over the Space

Executors

Tasks can be executed in a collocated asynchronous manner within the Space (processing unit with an embedded Space). To execute a task, you must have Execute privileges. Execution can be restricted to certain tasks by applying the 'Class-Filter'. There is no need to define specific privileges for operations being performed by the task on the Space.

Here is a simple implementation of a task that performs a 'count' operation on the space.

private static final class MyTask implements Task<Integer> {
   @TaskGigaSpace
   transient GigaSpace gigaSpace;

   public Integer execute() throws Exception {
      return gigaSpace.count(null,null);
   };
}

While executed tasks are effective when collocated, you may require operations on the Cluster.

GigaSpace clustered = gigaSpace.getClustered();

Executors Based Remoting

Executors Based Remoting

Executor Remoting allows you to use remote invocations of POJO services, with the Space as the transport layer using OpenSpaces Executors. To invoke a service method, you must have Execute privileges for class org.openspaces.remoting.ExecutorRemotingTask.

Event Driven Remoting

Event Driven Remoting

Event Driven Remoting allows you to use remote invocations of POJO services, with the space as the transport layer using a polling container on the space side to process the invocations. Under the wires, event driven remoting uses the Space write and take capabilities. Thus, you must have Write and Take privileges (at both ends) for class org.openspaces.remoting.EventDrivenSpaceRemotingEntry.

JDBC Driver

JDBC Driver

GigaSpaces allows applications to connect using a JDBC driver. A GigaSpaces JDBC driver accepts SQL statements, translates them to Space operations, and returns standard result sets. To acquire a connection to a remote secured space, provide the credentials (username and password) as parameters to the connection.

Class.forName("com.j_spaces.jdbc.driver.GDriver").newInstance();
String url = "jdbc:gigaspaces:url:jini://*/*/space";
Connection conn = DriverManager.getConnection(url, "user", "password");
Statement st = conn.createStatement();
...

An alternative way of querying the Space using SQL syntax is the SQLQuery class, with a privileged GigaSpace proxy.

IMPORTANT: This is an old version of GigaSpaces XAP. Click here for the latest version.

Labels

 
(None)