luoxiner commented on code in PR #2176:
URL: https://github.com/apache/zookeeper/pull/2176#discussion_r1758593177


##########
zookeeper-server/src/main/java/org/apache/zookeeper/util/SecurityUtils.java:
##########
@@ -254,15 +264,67 @@ public SaslServer run() {
         return null;
     }
 
+    /**
+     * get specific section from configuration or thrown
+     * an IOException when no section exists in configuration
+     *
+     * @param configuration Configuration instance
+     * @param section section name
+     * @return AppConfigurationEntry list
+     */
+    public static AppConfigurationEntry[] 
getAppConfigurationEntryWithSection(Configuration configuration, String 
section) throws IOException {
+        AppConfigurationEntry[] configurationEntries = 
configuration.getAppConfigurationEntry(section);
+        if (configurationEntries == null) {
+            String errorMessage = "Could not find a '" + section + "' entry in 
this configuration: Server cannot start.";
+            LOG.error(errorMessage);
+            throw new IOException(errorMessage);
+        }
+        return configurationEntries;
+    }
+
+
+     /**
+     * make server credentials map from configuration's server section.
+     * @param configuration Configuration instance
+     * @return Server credentials map
+     */
+    public static Map<String, String> getServerCredentials(Configuration 
configuration) throws IOException {
+        AppConfigurationEntry[] serverAppConfigurationEntry = 
getServerAppConfigurationEntry(configuration);
+        Map<String, String> credentials = new HashMap<>();
+        for (AppConfigurationEntry entry : serverAppConfigurationEntry) {
+            Map<String, ?> options = entry.getOptions();
+            // Populate DIGEST-MD5 user -> password map with JAAS 
configuration entries from the "Server" section.

Review Comment:
   I will make a new pull request to resolve it.



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to