A client is authenticated when it connects with valid credentials to a GemFire cache server that is configured with the client authentication callback. For details on the server’s role in authentication and what it expects from the client, see Implementing Authentication in the GemFire User Guide.

In your application, authentication credentials must be set when creating the cache. In practice, this means setting the authentication credentials when you create the CacheFactory.

C++ Authentication Example

In this C++ authentication example, the CacheFactory creation process sets the authentication callback:

  auto cache = CacheFactory()
      .set("log-level", "none")
      .setAuthInitialize(std::unique_ptr<ExampleAuthInitialize>(new ExampleAuthInitialize()))

Credentials are implemented in the getCredentials member function of the ExampleAuthInitialize, which is derived from the AuthInitialize abstract class.

std::shared_ptr<Properties> ExampleAuthInitialize::getCredentials(
    const std::shared_ptr<Properties>& securityprops,
    const std::string& /*server*/) {

  securityprops->insert("security-username", "root");
  securityprops->insert("security-password", "root");

  return securityprops;