@@ -104,7 +104,13 @@ public void initializeSslSocketFactory() throws Exception {
104
104
builder .put ("xpack.security.authc.realms." + REALM_NAME + ".ssl.truststore.path" , truststore );
105
105
mockSecureSettings .setString ("xpack.security.authc.realms." + REALM_NAME + ".ssl.truststore.secure_password" , "changeit" );
106
106
builder .put ("xpack.security.authc.realms." + REALM_NAME + ".ssl.verification_mode" , VerificationMode .CERTIFICATE );
107
+
108
+ // If not using global ssl, need to set the truststore for the "full verification" realm
109
+ builder .put ("xpack.security.authc.realms.vmode_full.ssl.truststore.path" , truststore );
110
+ mockSecureSettings .setString ("xpack.security.authc.realms.vmode_full.ssl.truststore.secure_password" , "changeit" );
107
111
}
112
+ builder .put ("xpack.security.authc.realms.vmode_full.ssl.verification_mode" , VerificationMode .FULL );
113
+
108
114
globalSettings = builder .setSecureSettings (mockSecureSettings ).build ();
109
115
Environment environment = TestEnvironment .newEnvironment (globalSettings );
110
116
sslService = new SSLService (globalSettings , environment );
@@ -188,10 +194,10 @@ public void testStandardLdapConnectionHostnameVerificationFailure() throws Excep
188
194
Settings settings = Settings .builder ()
189
195
// The certificate used in the vagrant box is valid for "localhost", but not for "127.0.0.1"
190
196
.put (buildLdapSettings (OPEN_LDAP_IP_URL , userTemplate , groupSearchBase , LdapSearchScope .ONE_LEVEL ))
191
- .put ("ssl.verification_mode" , VerificationMode .FULL )
192
197
.build ();
193
198
194
- RealmConfig config = new RealmConfig ("oldap-test" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
199
+ // Pick up the "full" verification mode config
200
+ RealmConfig config = new RealmConfig ("vmode_full" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
195
201
new ThreadContext (Settings .EMPTY ));
196
202
LdapSessionFactory sessionFactory = new LdapSessionFactory (config , sslService , threadPool );
197
203
@@ -211,10 +217,10 @@ public void testStandardLdapConnectionHostnameVerificationSuccess() throws Excep
211
217
Settings settings = Settings .builder ()
212
218
// The certificate used in the vagrant box is valid for "localhost" (but not for "127.0.0.1")
213
219
.put (buildLdapSettings (OPEN_LDAP_DNS_URL , userTemplate , groupSearchBase , LdapSearchScope .ONE_LEVEL ))
214
- .put ("ssl.verification_mode" , VerificationMode .FULL )
215
220
.build ();
216
221
217
- RealmConfig config = new RealmConfig ("oldap-test" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
222
+ // Pick up the "full" verification mode config
223
+ RealmConfig config = new RealmConfig ("vmode_full" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
218
224
new ThreadContext (Settings .EMPTY ));
219
225
LdapSessionFactory sessionFactory = new LdapSessionFactory (config , sslService , threadPool );
220
226
0 commit comments