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



##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
##########
@@ -151,9 +151,9 @@ private void 
verifyServerConnectionSubjectsAreLoggedIn(AcceptorImpl acceptor) {
     authorizations = new ArrayList<>();
     for (ServerConnection sc : acceptor.getAllServerConnections()) {
       ClientUserAuths auth = sc.getClientUserAuths();
-      assertThat(auth.getSubjects().size()).isNotEqualTo(0);
+      assertThat(auth.getAllSubjects().size()).isNotEqualTo(0);

Review comment:
       done

##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
##########
@@ -204,7 +204,7 @@ private void verifyServerConnectionSubjectsAreLoggedOut() {
     }
 
     for (ClientUserAuths auth : authorizations) {
-      assertThat(auth.getSubjects().size()).isEqualTo(0);
+      assertThat(auth.getAllSubjects().size()).isEqualTo(0);

Review comment:
       done

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
##########
@@ -774,14 +770,23 @@ protected boolean close(boolean checkQueue, boolean 
stoppedNormally) {
 
     connected = false;
 
-    // Close the Authorization callback (if any)
+    // Close the Authorization callback or subject if we are not keeping the 
proxy
     try {
       if (!pauseDurable) {
-        if (postAuthzCallback != null) {// for single user
+        // single user case -- old security
+        if (postAuthzCallback != null) {
           postAuthzCallback.close();
           postAuthzCallback = null;
         }
-        if (clientUserAuths != null) {// for multiple users
+        // single user case -- integrated security
+        // connection is closed, so we can log out this subject
+        else if (subject != null) {
+          logger.debug("CacheClientProxy.close, logging out: " + 
subject.getPrincipal());

Review comment:
       done

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUserAuths.java
##########
@@ -90,28 +120,29 @@ public UserAuthAttributes getUserAuthAttributes(final Long 
userId) {
   }
 
   @VisibleForTesting
-  protected Collection<Subject> getSubjects() {
-    return Collections.unmodifiableCollection(uniqueIdVsSubject.values());
-  }
-
-  public Subject getSubject(final Long userId) {
-    return uniqueIdVsSubject.get(userId);
-  }
-
-  public void removeSubject(final Long userId) {
-    logger.debug("Subject of {} removed.", userId);
-    removeSubject(uniqueIdVsSubject.remove(userId));
+  @TestOnly

Review comment:
       `@VisibleForTesting` tag was pre-existing, I added the `@TestOnly` 
because I found out it's only used for test, so `TestOnly` should be more 
appropriate. I removed the `VisibleForTesting` tag.

##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
##########
@@ -151,9 +151,9 @@ private void 
verifyServerConnectionSubjectsAreLoggedIn(AcceptorImpl acceptor) {
     authorizations = new ArrayList<>();
     for (ServerConnection sc : acceptor.getAllServerConnections()) {
       ClientUserAuths auth = sc.getClientUserAuths();
-      assertThat(auth.getSubjects().size()).isNotEqualTo(0);
+      assertThat(auth.getAllSubjects().size()).isNotEqualTo(0);

Review comment:
       done

##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
##########
@@ -204,7 +204,7 @@ private void verifyServerConnectionSubjectsAreLoggedOut() {
     }
 
     for (ClientUserAuths auth : authorizations) {
-      assertThat(auth.getSubjects().size()).isEqualTo(0);
+      assertThat(auth.getAllSubjects().size()).isEqualTo(0);

Review comment:
       done

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
##########
@@ -774,14 +770,23 @@ protected boolean close(boolean checkQueue, boolean 
stoppedNormally) {
 
     connected = false;
 
-    // Close the Authorization callback (if any)
+    // Close the Authorization callback or subject if we are not keeping the 
proxy
     try {
       if (!pauseDurable) {
-        if (postAuthzCallback != null) {// for single user
+        // single user case -- old security
+        if (postAuthzCallback != null) {
           postAuthzCallback.close();
           postAuthzCallback = null;
         }
-        if (clientUserAuths != null) {// for multiple users
+        // single user case -- integrated security
+        // connection is closed, so we can log out this subject
+        else if (subject != null) {
+          logger.debug("CacheClientProxy.close, logging out: " + 
subject.getPrincipal());

Review comment:
       done

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUserAuths.java
##########
@@ -90,28 +120,29 @@ public UserAuthAttributes getUserAuthAttributes(final Long 
userId) {
   }
 
   @VisibleForTesting
-  protected Collection<Subject> getSubjects() {
-    return Collections.unmodifiableCollection(uniqueIdVsSubject.values());
-  }
-
-  public Subject getSubject(final Long userId) {
-    return uniqueIdVsSubject.get(userId);
-  }
-
-  public void removeSubject(final Long userId) {
-    logger.debug("Subject of {} removed.", userId);
-    removeSubject(uniqueIdVsSubject.remove(userId));
+  @TestOnly

Review comment:
       `@VisibleForTesting` tag was pre-existing, I added the `@TestOnly` 
because I found out it's only used for test, so `TestOnly` should be more 
appropriate. I removed the `VisibleForTesting` tag.




-- 
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