kirklund commented on a change in pull request #6721:
URL: https://github.com/apache/geode/pull/6721#discussion_r678716786



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
##########
@@ -100,6 +100,8 @@
   private static final String 
DISALLOW_INTERNAL_MESSAGES_WITHOUT_CREDENTIALS_NAME =
       "geode.disallow-internal-messages-without-credentials";
 
+  public static final String USER_NOT_FOUND = "User authorization attributes 
not found.";

Review comment:
       Please change the constant to `private`.

##########
File path: 
geode-junit/src/main/java/org/apache/geode/security/UpdatableUserAuthInitialize.java
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.security;
+
+import java.util.Properties;
+
+import org.apache.geode.distributed.DistributedMember;
+
+/**
+ * this is used in conjunction with ExpirableSecurityManager. It will create a 
new set of
+ * credentials every time getCredentials are called, and they will always be 
authenticated
+ * and authorized by the ExpirableSecurityManager.
+ *
+ * make sure reset is called after each test to clean things up.
+ */
+public class UpdatableUserAuthInitialize implements AuthInitialize {
+  // use static field for ease of testing since there is only one instance of 
this in each VM
+  private static String user;
+
+  @Override
+  public Properties getCredentials(Properties securityProps, DistributedMember 
server,
+      boolean isPeer) throws AuthenticationFailedException {
+    Properties credentials = new Properties();
+    credentials.put("security-username", user);
+    credentials.put("security-password", user);
+    return credentials;
+  }
+
+  public static String getUser() {
+    return user;
+  }
+
+  public static void setUser(String user) {
+    UpdatableUserAuthInitialize.user = user;

Review comment:
       It's probably best to just change the `user` field to be of type 
AtomicReference<String>:
   ```
   private static final AtomicReference<String> USER = new AtomicReference<>();
   ```




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