Multiple Secure Client Example

In a client/server installation with security, you can create multiple, secure connections to your servers from a single client.

The most common use case is a GemFire client embedded in an application server that supports data requests from many users. Each user can be authorized to access a subset of data on the servers. For example, customer users may be allowed to see and update only their own orders and shipments. You create the multiple user connections from the single ClientCache instance in your client application. Each user provides its own credentials, and accesses the servers at its own individual authorization level.

Running the Example

This example shows a very simple client/server that uses multiuser authentication in the client. The server listens on a port for client requests and updates. The client does put and get on the server on behalf of multiple users with different credentials. This client uses the valid username and password.

Note: To run this example, you must have terminal sessions configured for the QuickStart examples, as described in Setting Up Your Environment.
  1. Add <product_installation_dir>/lib/gfSecurityImpl.jar to your CLASSPATH where <product_installation_dir> is the location where you installed GemFire.
  2. In one session, start the server:

    $ java quickstart.MultiuserSecurityServer
  3. In the other session start the client:

    $ java quickstart.MultiuserSecurityClient
  4. Follow the instructions on the screens. You can run the client multiple times trying different operations. Once you are done and the client has exited, press Enter to stop the server.

Example Source Files

Program and cache configuration source files for the client and the server:

Table 1. Cache configuration files, located in SampleCode//quickstart/xml
MultiuserSecurityServer.xml Configures a cache to serve caching clients.
MultiuserSecurityClient.xml Configures a region as a client region in a Security cache. The region's pool connects to the cacheserver.
Table 2. Java program files, located in SampleCode/quickstart/quickstart
MultiuserSecurityServer.java This server starts on a port with security properties for client requests.
MultiuserSecurityClient.java A client that does put and get on the server on behalf of multiple users with different credentials. This client uses the valid username and password.
MultiGetFunction.java Application Function to retrieve values for multiple keys in a region.
Related Topics
Security

Related Javadocs