"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap/LdapSessionFactoryTests.java" between
elasticsearch-6.8.14-src.tar.gz and elasticsearch-6.8.15-src.tar.gz

About: elasticsearch is a Distributed, RESTful, Search Engine built on top of Apache Lucene. Source package (GitHub).

LdapSessionFactoryTests.java  (elasticsearch-6.8.14-src):LdapSessionFactoryTests.java  (elasticsearch-6.8.15-src)
skipping to change at line 241 skipping to change at line 241
String ldapUrl = new LDAPURL("ldaps", NetworkAddress.format(listenAddres s), ldapServer.getListenPort("ldaps"), String ldapUrl = new LDAPURL("ldaps", NetworkAddress.format(listenAddres s), ldapServer.getListenPort("ldaps"),
null, null, null, null).toString(); null, null, null, null).toString();
String groupSearchBase = "o=sevenSeas"; String groupSearchBase = "o=sevenSeas";
String userTemplates = "cn={0},ou=people,o=sevenSeas"; String userTemplates = "cn={0},ou=people,o=sevenSeas";
Settings settings = Settings.builder() Settings settings = Settings.builder()
.put(globalSettings) .put(globalSettings)
.put(buildLdapSettings(ldapUrl, userTemplates, groupSearchBase, Ldap SearchScope.SUB_TREE)) .put(buildLdapSettings(ldapUrl, userTemplates, groupSearchBase, Ldap SearchScope.SUB_TREE))
.build(); .build();
// !!!make sure that the file size on disk for the two pem CAs is differ
ent!!!
// otherwise, the resource watcher has to rely on the last modified time
stamp to detect changes,
// and the resolution for that can be as low as a second, and the test w
ould spuriously fail
final Path realCa = getDataPath("/org/elasticsearch/xpack/security/authc /ldap/support/ldap-ca.crt"); final Path realCa = getDataPath("/org/elasticsearch/xpack/security/authc /ldap/support/ldap-ca.crt");
final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc /ldap/support/smb_ca.crt"); final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc /ldap/support/ad.crt");
final Environment environment = TestEnvironment.newEnvironment(settings) ; final Environment environment = TestEnvironment.newEnvironment(settings) ;
RealmConfig config = new RealmConfig("ldap_realm", settings, globalSetti ngs, environment, new ThreadContext(settings)); RealmConfig config = new RealmConfig("ldap_realm", settings, globalSetti ngs, environment, new ThreadContext(settings));
LdapSessionFactory sessionFactory = new LdapSessionFactory(config, sslSe rvice, threadPool); LdapSessionFactory sessionFactory = new LdapSessionFactory(config, sslSe rvice, threadPool);
String user = "Horatio Hornblower"; String user = "Horatio Hornblower";
SecureString userPass = new SecureString("pass"); SecureString userPass = new SecureString("pass");
final ResourceWatcherService resourceWatcher = new ResourceWatcherServic e(settings, threadPool); final ResourceWatcherService resourceWatcher = new ResourceWatcherServic e(settings, threadPool);
new SSLConfigurationReloader(environment, sslService, resourceWatcher); new SSLConfigurationReloader(environment, sslService, resourceWatcher);
Files.copy(fakeCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING); Files.copy(fakeCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING);
// resourceWatcher looks at the file size and last access timestamp to d etect changes
resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH); resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH);
UncategorizedExecutionException e = UncategorizedExecutionException e =
expectThrows(UncategorizedExecutionException.class, () -> session(se ssionFactory, user, userPass)); expectThrows(UncategorizedExecutionException.class, () -> session(se ssionFactory, user, userPass));
assertThat(e.getCause(), instanceOf(ExecutionException.class)); assertThat(e.getCause(), instanceOf(ExecutionException.class));
assertThat(e.getCause().getCause(), instanceOf(LDAPException.class)); assertThat(e.getCause().getCause(), instanceOf(LDAPException.class));
assertThat(e.getCause().getCause().getMessage(), containsString("SSLPeer UnverifiedException")); assertThat(e.getCause().getCause().getMessage(), containsString("SSLPeer UnverifiedException"));
Files.copy(realCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING); Files.copy(realCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING);
resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH); resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH);
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)