Search in sources :

Example 1 with MockSecureSettings

use of org.elasticsearch.common.settings.MockSecureSettings in project elasticsearch by elastic.

the class AwsS3ServiceImplTests method testAwsCredsExplicitConfigSettings.

public void testAwsCredsExplicitConfigSettings() {
    Settings repositorySettings = Settings.builder().put(InternalAwsS3Service.CLIENT_NAME.getKey(), "myconfig").build();
    MockSecureSettings secureSettings = new MockSecureSettings();
    secureSettings.setString("s3.client.myconfig.access_key", "aws_key");
    secureSettings.setString("s3.client.myconfig.secret_key", "aws_secret");
    secureSettings.setString("s3.client.default.access_key", "wrong_key");
    secureSettings.setString("s3.client.default.secret_key", "wrong_secret");
    Settings settings = Settings.builder().setSecureSettings(secureSettings).build();
    launchAWSCredentialsWithElasticsearchSettingsTest(repositorySettings, settings, "aws_key", "aws_secret");
}
Also used : MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) Settings(org.elasticsearch.common.settings.Settings) MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings)

Example 2 with MockSecureSettings

use of org.elasticsearch.common.settings.MockSecureSettings in project elasticsearch by elastic.

the class InternalSettingsPreparerTests method testSecureSettings.

public void testSecureSettings() {
    MockSecureSettings secureSettings = new MockSecureSettings();
    secureSettings.setString("foo", "secret");
    Settings input = Settings.builder().put(baseEnvSettings).setSecureSettings(secureSettings).build();
    Environment env = InternalSettingsPreparer.prepareEnvironment(input, null);
    Setting<SecureString> fakeSetting = SecureSetting.secureString("foo", null, false);
    assertEquals("secret", fakeSetting.get(env.settings()).toString());
}
Also used : Environment(org.elasticsearch.env.Environment) MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) Settings(org.elasticsearch.common.settings.Settings) SecureString(org.elasticsearch.common.settings.SecureString)

Example 3 with MockSecureSettings

use of org.elasticsearch.common.settings.MockSecureSettings in project elasticsearch by elastic.

the class AwsS3ServiceImplTests method testAWSConfigurationWithAwsSettings.

public void testAWSConfigurationWithAwsSettings() {
    MockSecureSettings secureSettings = new MockSecureSettings();
    secureSettings.setString("s3.client.default.proxy.username", "aws_proxy_username");
    secureSettings.setString("s3.client.default.proxy.password", "aws_proxy_password");
    Settings settings = Settings.builder().setSecureSettings(secureSettings).put("s3.client.default.protocol", "http").put("s3.client.default.proxy.host", "aws_proxy_host").put("s3.client.default.proxy.port", 8080).put("s3.client.default.read_timeout", "10s").build();
    launchAWSConfigurationTest(settings, Settings.EMPTY, Protocol.HTTP, "aws_proxy_host", 8080, "aws_proxy_username", "aws_proxy_password", null, 3, false, 10000);
}
Also used : MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) Settings(org.elasticsearch.common.settings.Settings)

Example 4 with MockSecureSettings

use of org.elasticsearch.common.settings.MockSecureSettings in project elasticsearch by elastic.

the class AwsS3ServiceImplTests method testAwsCredsDefaultSettings.

public void testAwsCredsDefaultSettings() {
    MockSecureSettings secureSettings = new MockSecureSettings();
    secureSettings.setString("s3.client.default.access_key", "aws_key");
    secureSettings.setString("s3.client.default.secret_key", "aws_secret");
    Settings settings = Settings.builder().setSecureSettings(secureSettings).build();
    launchAWSCredentialsWithElasticsearchSettingsTest(Settings.EMPTY, settings, "aws_key", "aws_secret");
}
Also used : MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) MockSecureSettings(org.elasticsearch.common.settings.MockSecureSettings) Settings(org.elasticsearch.common.settings.Settings)

Aggregations

MockSecureSettings (org.elasticsearch.common.settings.MockSecureSettings)4 Settings (org.elasticsearch.common.settings.Settings)4 SecureString (org.elasticsearch.common.settings.SecureString)1 Environment (org.elasticsearch.env.Environment)1