Multiple Secure Client Example
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.
-
In one session, start the server:
$ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar:$GEMFIRE/lib/gfSecurityImpl.jar" quickstart.MultiuserSecurityServer
-
In the other session start the client:
$ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar:$GEMFIRE/lib/gfSecurityImpl.jar" quickstart.MultiuserSecurityClient
-
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:
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. |
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
- com.gemstone.gemfire.security (Javadoc)