Skip to content

Commit 2b26f96

Browse files
committed
fixup! Simplify test
1 parent 67c2793 commit 2b26f96

File tree

8 files changed

+9
-203
lines changed

8 files changed

+9
-203
lines changed

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/authz/microsoft/MicrosoftGraphAuthzPluginIT.java

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@
2222
import org.elasticsearch.xcontent.json.JsonXContent;
2323
import org.elasticsearch.xpack.security.authc.saml.SamlIdpMetadataBuilder;
2424
import org.elasticsearch.xpack.security.authc.saml.SamlResponseBuilder;
25-
import org.junit.BeforeClass;
2625
import org.junit.ClassRule;
2726
import org.junit.rules.RuleChain;
2827
import org.junit.rules.TestRule;
2928

30-
import java.io.FileNotFoundException;
3129
import java.io.IOException;
3230
import java.net.URISyntaxException;
3331
import java.net.URL;
3432
import java.nio.charset.StandardCharsets;
35-
import java.nio.file.Path;
3633
import java.security.cert.CertificateException;
3734
import java.util.Base64;
3835
import java.util.HashMap;
@@ -44,28 +41,18 @@
4441

4542
public class MicrosoftGraphAuthzPluginIT extends ESRestTestCase {
4643
public static ElasticsearchCluster cluster = initTestCluster();
47-
private static Path caPath;
4844

4945
@ClassRule
5046
public static TestRule ruleChain = RuleChain.outerRule(cluster);
5147

52-
private static final String IDP_ENTITY_ID = "https://idp.example.org/";
48+
private static final String IDP_ENTITY_ID = "http://idp.example.org/";
5349

5450
private static ElasticsearchCluster initTestCluster() {
5551
return ElasticsearchCluster.local()
5652
.setting("xpack.security.enabled", "true")
5753
.setting("xpack.license.self_generated.type", "trial")
5854
.setting("xpack.security.authc.token.enabled", "true")
59-
.setting("xpack.security.authc.api_key.enabled", "true")
60-
.setting("xpack.security.http.ssl.enabled", "true")
61-
.setting("xpack.security.http.ssl.certificate", "node.crt")
62-
.setting("xpack.security.http.ssl.key", "node.key")
63-
.setting("xpack.security.http.ssl.certificate_authorities", "ca.crt")
64-
.setting("xpack.security.transport.ssl.enabled", "true")
65-
.setting("xpack.security.transport.ssl.certificate", "node.crt")
66-
.setting("xpack.security.transport.ssl.key", "node.key")
67-
.setting("xpack.security.transport.ssl.certificate_authorities", "ca.crt")
68-
.setting("xpack.security.transport.ssl.verification_mode", "certificate")
55+
.setting("xpack.security.http.ssl.enabled", "false")
6956
.plugin("microsoft-graph-authz")
7057
.keystore("bootstrap.password", "x-pack-test-password")
7158
.user("test_admin", "x-pack-test-password", User.ROOT_USER_ROLE, true)
@@ -79,9 +66,9 @@ private static ElasticsearchCluster initTestCluster() {
7966
.setting("xpack.security.authc.realms.saml.saml1.idp.metadata.path", "metadata.xml")
8067
.setting("xpack.security.authc.realms.saml.saml1.attributes.principal", "urn:oid:2.5.4.3")
8168
.setting("xpack.security.authc.realms.saml.saml1.ssl.certificate_authorities", "ca.crt")
82-
.setting("xpack.security.authc.realms.saml.saml1.sp.entity_id", "https://sp/default.example.org/")
83-
.setting("xpack.security.authc.realms.saml.saml1.sp.acs", "https://acs/default")
84-
.setting("xpack.security.authc.realms.saml.saml1.sp.logout", "https://logout/default")
69+
.setting("xpack.security.authc.realms.saml.saml1.sp.entity_id", "http://sp/default.example.org/")
70+
.setting("xpack.security.authc.realms.saml.saml1.sp.acs", "http://acs/default")
71+
.setting("xpack.security.authc.realms.saml.saml1.sp.logout", "http://logout/default")
8572
.setting("xpack.security.authc.realms.saml.saml1.authorization_realms", "microsoft_graph1")
8673
.setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.order", "2")
8774
.build();
@@ -97,29 +84,20 @@ private static String getIDPMetadata() {
9784
return null;
9885
}
9986

100-
@BeforeClass
101-
public static void loadCertificateAuthority() throws Exception {
102-
URL resource = MicrosoftGraphAuthzPluginIT.class.getResource("/ssl/ca.crt");
103-
if (resource == null) {
104-
throw new FileNotFoundException("Cannot find classpath resource /ssl/ca.crt");
105-
}
106-
caPath = PathUtils.get(resource.toURI());
107-
}
108-
10987
@Override
11088
protected String getTestRestCluster() {
11189
return cluster.getHttpAddresses();
11290
}
11391

11492
@Override
11593
protected String getProtocol() {
116-
return "https";
94+
return "http";
11795
}
11896

11997
@Override
12098
protected Settings restClientSettings() {
12199
final String token = basicAuthHeaderValue("rest_test", new SecureString("rest_password".toCharArray()));
122-
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", token).put(CERTIFICATE_AUTHORITIES, caPath).build();
100+
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", token).build();
123101
}
124102

125103
@Override
@@ -133,9 +111,9 @@ public void testAuthenticationSuccessful() throws Exception {
133111
}
134112

135113
private String getSamlAssertionJsonBodyString(String username) throws Exception {
136-
var message = new SamlResponseBuilder().spEntityId("https://sp/default.example.org/")
114+
var message = new SamlResponseBuilder().spEntityId("http://sp/default.example.org/")
137115
.idpEntityId(IDP_ENTITY_ID)
138-
.acs(new URL("https://acs/default"))
116+
.acs(new URL("http://acs/default"))
139117
.attribute("urn:oid:2.5.4.3", username)
140118
.sign(getDataPath("/saml/signing.crt"), getDataPath("/saml/signing.key"), new char[0])
141119
.asString();

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/README.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/ca.crt

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/ca.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/http.crt

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/http.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/node.crt

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/security/qa/microsoft-graph-authz-tests/src/javaRestTest/resources/ssl/node.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)