jmelchio commented on a change in pull request #6755:
URL: https://github.com/apache/geode/pull/6755#discussion_r686970570
##########
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 was unable to reuse the `regionService` but came up with a way
accomplish the automatic re-authentication behind the scenes with changes to
the `AuthInitialize` implementation we're using for the tests.
--
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]