Skip to content

Commit

Permalink
SaslPropertiesResolver should not allow mutation of its internal state (
Browse files Browse the repository at this point in the history
#32)

* SaslPropertiesResolver should not allow mutation of its internal state

* Keep SASL properties map sorted

---------

Co-authored-by: Charles Connell <[email protected]>
  • Loading branch information
charlesconnell and charlesconnell authored Nov 7, 2023
1 parent 547beb8 commit 6761522
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.net.InetAddress;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import javax.security.sasl.Sasl;
Expand All @@ -38,7 +39,7 @@
*
*/
public class SaslPropertiesResolver implements Configurable{
private Map<String,String> properties;
private SortedMap<String,String> properties;
Configuration conf;

/**
Expand Down Expand Up @@ -82,7 +83,7 @@ public Configuration getConf() {
* @return sasl Properties
*/
public Map<String,String> getDefaultProperties() {
return properties;
return new TreeMap<>(properties);
}

/**
Expand All @@ -91,7 +92,7 @@ public Map<String,String> getDefaultProperties() {
* @return the sasl properties to be used for the connection.
*/
public Map<String, String> getServerProperties(InetAddress clientAddress){
return properties;
return new TreeMap<>(properties);
}

/**
Expand All @@ -111,7 +112,7 @@ public Map<String, String> getServerProperties(InetAddress clientAddress,
* @return the sasl properties to be used for the connection.
*/
public Map<String, String> getClientProperties(InetAddress serverAddress){
return properties;
return new TreeMap<>(properties);
}

/**
Expand Down

0 comments on commit 6761522

Please sign in to comment.