@Test
  public void dataReadCannotPut() throws Exception {
    Properties props = getVMPropertiesWithPermission("dataRead");
    if (shouldSetObjectFilterProperty(clientVmConfiguration)) {
      props.setProperty(ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER,
          "org.apache.geode.security.templates.UsernamePrincipal");
    }

    int locatorPort = locator.getPort();

    ClientVM clientVM = csRule.startClientVM(2, clientVmConfiguration, props,
        cf -> cf.addPoolLocator("localhost", locatorPort));

    clientVM.invoke(() -> {
      ClientCache cache = ClusterStartupRule.getClientCache();
      ClientRegionFactory<String, String> rf =
          cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
      Region<String, String> region = rf.create(regionName);

      assertThatThrownBy(() -> region.put(singleKey, singleValue))
          .hasCauseInstanceOf(NotAuthorizedException.class);
      assertThatThrownBy(() -> region.put(singleKey, singleValue, null))
          .hasCauseInstanceOf(NotAuthorizedException.class);
      assertThatThrownBy(() -> region.putAll(keyValueMap))
          .hasCauseInstanceOf(NotAuthorizedException.class);
      assertThatThrownBy(() -> region.putAll(keyValueMap, null))
          .hasCauseInstanceOf(NotAuthorizedException.class);
    });

    // Confirm server-side that no put went through:
    server.invoke(() -> {
      assertThat(ClusterStartupRule.getCache().getRegion(regionName)).containsOnlyKeys(initKey)
          .containsEntry(initKey, initValue);
    });

  }
Tests for authorization from client to server for data puts and gets. For similar test in the
case of failover, see {@link ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest}.

@since GemFire 5.5
geode-core/src/upgradeTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityDUnitTest.java