forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Fix Active Directory tests (elastic#47266)"
This reverts commit b917b57.
- Loading branch information
Showing
11 changed files
with
126 additions
and
127 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
...src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/samba4.crt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
package org.elasticsearch.xpack.security.authc.ldap; | ||
|
||
import org.elasticsearch.action.support.PlainActionFuture; | ||
import org.elasticsearch.common.Strings; | ||
import org.elasticsearch.common.settings.SecureString; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
|
@@ -14,8 +15,10 @@ | |
import org.elasticsearch.threadpool.TestThreadPool; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
import org.elasticsearch.xpack.core.security.authc.RealmConfig; | ||
import org.elasticsearch.xpack.core.security.authc.ldap.support.LdapSearchScope; | ||
import org.elasticsearch.xpack.core.ssl.SSLService; | ||
import org.elasticsearch.xpack.security.authc.ldap.support.LdapSession; | ||
import org.elasticsearch.xpack.security.authc.ldap.support.LdapTestCase; | ||
import org.elasticsearch.xpack.security.authc.ldap.support.SessionFactory; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
|
@@ -46,7 +49,7 @@ public void init() throws Exception { | |
|
||
globalSettings = Settings.builder() | ||
.put("path.home", createTempDir()) | ||
.put("xpack.security.authc.realms.ldap.ad-as-ldap-test.ssl.certificate_authorities", certPath) | ||
.put("xpack.security.authc.realms.active_directory.ad.ssl.certificate_authorities", certPath) | ||
.build(); | ||
sslService = new SSLService(globalSettings, env); | ||
threadPool = new TestThreadPool("ADLdapUserSearchSessionFactoryTests"); | ||
|
@@ -57,12 +60,15 @@ public void shutdown() { | |
terminate(threadPool); | ||
} | ||
|
||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/35738") | ||
public void testUserSearchWithActiveDirectory() throws Exception { | ||
String groupSearchBase = "DC=ad,DC=test,DC=elasticsearch,DC=com"; | ||
String userSearchBase = "CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com"; | ||
Settings settings = Settings.builder() | ||
.put("url", ActiveDirectorySessionFactoryTests.AD_LDAP_URL) | ||
.put("group_search.base_dn", groupSearchBase) | ||
.put(LdapTestCase.buildLdapSettings( | ||
new String[] { ActiveDirectorySessionFactoryTests.AD_LDAP_URL }, | ||
Strings.EMPTY_ARRAY, groupSearchBase, LdapSearchScope.SUB_TREE, null, | ||
true)) | ||
.put("user_search.base_dn", userSearchBase) | ||
.put("bind_dn", "[email protected]") | ||
.put("bind_password", ActiveDirectorySessionFactoryTests.PASSWORD) | ||
|
@@ -73,13 +79,13 @@ public void testUserSearchWithActiveDirectory() throws Exception { | |
Settings.Builder builder = Settings.builder() | ||
.put(globalSettings); | ||
settings.keySet().forEach(k -> { | ||
builder.copy("xpack.security.authc.realms.ldap.ad-as-ldap-test." + k, k, settings); | ||
builder.copy("xpack.security.authc.realms.ad-as-ldap-test." + k, k, settings); | ||
|
||
}); | ||
Settings fullSettings = builder.build(); | ||
sslService = new SSLService(fullSettings, TestEnvironment.newEnvironment(fullSettings)); | ||
RealmConfig config = new RealmConfig(new RealmConfig.RealmIdentifier("ldap", "ad-as-ldap-test"), fullSettings, | ||
TestEnvironment.newEnvironment(fullSettings), new ThreadContext(fullSettings)); | ||
RealmConfig config = new RealmConfig(new RealmConfig.RealmIdentifier("ad", "ad-as-ldap-test"), globalSettings, | ||
TestEnvironment.newEnvironment(globalSettings), new ThreadContext(globalSettings)); | ||
LdapUserSearchSessionFactory sessionFactory = getLdapUserSearchSessionFactory(config, sslService, threadPool); | ||
|
||
String user = "Bruce Banner"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.