thelabdude commented on a change in pull request #222:
URL: https://github.com/apache/solr/pull/222#discussion_r670825201
##########
File path:
solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java
##########
@@ -250,6 +276,33 @@ private void useReadonlyCredentials() {
System.setProperty(VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_USERNAME_VM_PARAM_NAME,
"readonlyACLUsername");
System.setProperty(VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_PASSWORD_VM_PARAM_NAME,
"readonlyACLPassword");
}
+
+ private void useReadonlyCredentialsFromFile() throws IOException {
+ useCredentialsFromFile("readonlyACLUsername", "readonlyACLPassword");
+ }
+
+ private void useAllCredentialsFromFile() throws IOException {
+ useCredentialsFromFile("connectAndAllACLUsername",
"connectAndAllACLPassword");
+ }
+
+ private void useCredentialsFromFile(String username, String password) throws
IOException {
+ clearSecuritySystemProperties();
+
+ System.setProperty(SolrZkClient.ZK_CRED_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
VMParamsSingleSetCredentialsDigestZkCredentialsProvider.class.getName());
+
+ Properties props = new Properties();
+
props.setProperty(VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_USERNAME_VM_PARAM_NAME,
username);
+
props.setProperty(VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_PASSWORD_VM_PARAM_NAME,
password);
+ saveCredentialsFile(props);
+ }
+
+ private void saveCredentialsFile(Properties props) throws IOException {
+ File credentialsFile = createTempFile("zk-creds", "properties").toFile();
+ try (FileWriter writer = new FileWriter(credentialsFile,
StandardCharsets.UTF_8)) {
+ props.store(writer, "test");
+ }
+
System.setProperty(VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_FILE_VM_PARAM_NAME,
credentialsFile.getAbsolutePath());
Review comment:
@madrob I think you have perms to just push that change to the PR
branch, no?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]