Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15484: Re-enable test, with workaround for localhost.localdomwin (#187)

Jan Høydahl59ad803f27ce
diff --git a/solr/core/src/test/org/apache/solr/security/JWTAuthPluginIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/JWTAuthPluginIntegrationTest.java
index c7bcb270510..e7b24312eb7 100644
--- a/solr/core/src/test/org/apache/solr/security/JWTAuthPluginIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/JWTAuthPluginIntegrationTest.java
@@ -127,7 +127,6 @@ public class JWTAuthPluginIntegrationTest extends SolrCloudAuthTestCase {
}
@Test
- @BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-15484")
public void mockOAuth2Server() throws Exception {
MiniSolrCloudCluster myCluster = configureClusterMockOauth(2, pemFilePath, 10000);
String baseUrl = myCluster.getRandomJetty(random()).getBaseUrl().toString();
@@ -428,8 +427,10 @@ public class JWTAuthPluginIntegrationTest extends SolrCloudAuthTestCase {
* Creates a security.json string which points to the MockOAuth server using it's well-known URL and trusting its SSL
*/
private static String createMockOAuthSecurityJson(Path pemFilePath) throws IOException {
- String wellKnown = mockOAuth2Server.wellKnownUrl("default").toString();
- String pemCert = CryptoKeys.extractCertificateFromPem(Files.readString(pemFilePath)).replaceAll("\n", "\\\\n");
+ String wellKnown = mockOAuth2Server.wellKnownUrl("default").toString()
+ .replace(".localdomain", ""); // Use only 'localhost' to match our SSL cert
+ String pemCert = CryptoKeys.extractCertificateFromPem(Files.readString(pemFilePath))
+ .replaceAll("\n", "\\\\n"); // Use literal \n to play well with JSON
return "{\n" +
" \"authentication\" : {\n" +
" \"class\": \"solr.JWTAuthPlugin\",\n" +