File tree 1 file changed +11
-3
lines changed
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -730,10 +730,18 @@ public static List<String> loadSettings(Settings settings) {
730
730
private static CredentialsProvider createCredentialsProvider (final Config config ) {
731
731
final String username = AUTH_USERNAME_SETTING .getConcreteSettingForNamespace (config .name ()).get (config .settings ());
732
732
733
+ final String deprecatedPassword = AUTH_PASSWORD_SETTING .getConcreteSettingForNamespace (config .name ()).get (config .settings ());
733
734
final SecureString securePassword = SECURE_AUTH_PASSWORDS .get (config .name ());
734
- final String password = securePassword == null
735
- ? AUTH_PASSWORD_SETTING .getConcreteSettingForNamespace (config .name ()).get (config .settings ())
736
- : securePassword .toString ();
735
+ final String password ;
736
+ if (securePassword != null ) {
737
+ password = securePassword .toString ();
738
+ if (Strings .isNullOrEmpty (deprecatedPassword ) == false ) {
739
+ logger .warn ("exporter [{}] specified both auth.secure_password and auth.password. using auth.secure_password and " +
740
+ "ignoring auth.password" , config .name ());
741
+ }
742
+ } else {
743
+ password = deprecatedPassword ;
744
+ }
737
745
738
746
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider ();
739
747
credentialsProvider .setCredentials (AuthScope .ANY , new UsernamePasswordCredentials (username , password ));
You can’t perform that action at this time.
0 commit comments