LATEST VERSION: 8.1.0 - CHANGELOG
Pivotal GemFire® v8.1

Secure Client Example

Secure Client Example

You establish trust by verifying credentials when one process connects to another.

The security framework establishes trust between members, and authorizes client cache operations based on that trust. New members connect to the locator in a peer-to-peer topology, providing credentials to the locators. Clients connect to cache servers, providing credentials to the servers. One system connects to another in a multi-site system, using mutual authentication.

Running the Example

The example shows a very simple client/server configuration that uses security. The server starts on a port with security properties for client requests. The client does puts and gets on the server with valid PUT credentials. The client uses the valid LDAP 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 for Running the Examples. In addition, you will require an accessible LDAP server to perform authentication.
  1. In one session, start the server:

    $ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar:$GEMFIRE/lib/gfSecurityImpl.jar" quickstart.SecurityServer ldap ou=ldapserver,dc=mytown,dc=mycompany,dc=com
    Replace the LDAP server location information with your LDAP server information.
  2. In the other session start the client:

    $ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar:$GEMFIRE/lib/gfSecurityImpl.jar" quickstart.SecurityClient my_user my_password
    
    Replace the username and password with a valid LDAP username and password.
  3. Follow the instructions on the screens. When the client exits, press Enter to stop the server.

Example Source Files

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

Table 1. Cache configuration files, located in SampleCode/quickstart/xml
SecurityServer.xml Configures a cache to serve caching clients. The example region also is configured with a loader.
SecurityClient.xml Configures a region as a client region in a Security cache.
Table 2. Java program files, located in SampleCode/quickstart/quickstart
SecurityServer.java A server that starts on a port with security properties for client requests.
SecurityClient.java Does put and get on the server with valid PUT credentials. This client uses the valid LDAP username and password.
Related Topics
Security

Related Javadocs

  • com.gemstone.gemfire.security