jinmeiliao commented on a change in pull request #6755:
URL: https://github.com/apache/geode/pull/6755#discussion_r686362051



##########
File path: 
geode-core/src/upgradeTest/java/org/apache/geode/security/AuthExpirationDUnitTest.java
##########
@@ -109,4 +116,92 @@ public void 
clientShouldReAuthenticateWhenCredentialExpiredAndOperationSucceed()
     assertThat(region.size()).isEqualTo(2);
   }
 
+  @Test
+  public void 
userShouldReAuthenticateWhenCredentialExpiredAndOperationSucceed() throws 
Exception {
+    int serverPort = server.getPort();
+    ClientVM clientVM = lsRule.startClientVM(0, clientVersion,
+        c -> c.withMultiUser(true)
+            .withProperty(SECURITY_CLIENT_AUTH_INIT, 
UpdatableUserAuthInitialize.class.getName())
+            .withPoolSubscription(true)
+            .withServerConnection(serverPort));
+
+    clientVM.invoke(() -> {
+      UpdatableUserAuthInitialize.setUser("user1");
+      ClientCache clientCache = ClusterStartupRule.getClientCache();
+      assert clientCache != null;
+      
clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("region");
+      Properties userSecurityProperties = new Properties();
+      userSecurityProperties.put("security-username", "serviceUser0");
+      userSecurityProperties.put("security-password", "serviceUser0");
+      RegionService regionService = 
clientCache.createAuthenticatedView(userSecurityProperties);
+      Region<Object, Object> region = regionService.getRegion("/region");
+      region.put(0, "value0");
+    });
+
+    clientVM.invoke(() -> {
+      ClientCache clientCache = ClusterStartupRule.getClientCache();
+      Properties userSecurityProperties = new Properties();
+      userSecurityProperties.put("security-username", "serviceUser1");
+      userSecurityProperties.put("security-password", "serviceUser1");
+      assert clientCache != null;
+      RegionService regionService = 
clientCache.createAuthenticatedView(userSecurityProperties);
+      Region<Object, Object> region = regionService.getRegion("/region");
+      region.put(1, "value1");
+      regionService.close();

Review comment:
       I would think user would continue to use same regionService and expect 
the next put to succeed. (the whole expire user and re-authenticate happens 
behind the scene and the client is doing operations like nothing happened). 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to