QPID-8363: [Broker-J] Fix tests for JDK11 and above
(cherry picked from commit 7e533a36cbb69cdf0cde90f7ccb095ccfe659fe0)
diff --git a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerTest.java b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerTest.java
index 590f076..3f6efa5 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerTest.java
@@ -125,6 +125,8 @@
{
@CreateTransport(protocol = "TCP", port = 0)
},
+ kdcPrincipal="krbtgt/QPID.ORG@QPID.ORG",
+ primaryRealm="QPID.ORG",
searchBaseDn = "ou=users,dc=qpid,dc=org")
@ApplyLdifFiles("users.ldif")
public class SimpleLDAPAuthenticationManagerTest extends UnitTestBase
@@ -378,6 +380,13 @@
final KdcServer kdcServer =
ServerAnnotationProcessor.getKdcServer(LDAP.getDirectoryService(), ldapServer.getPort() + 1);
kdcServer.getConfig().setPaEncTimestampRequired(false);
+
+ final int port = kdcServer.getTransports()[0].getPort();
+ final String krb5confPath = createKrb5Conf(port);
+ SYSTEM_PROPERTY_SETTER.setSystemProperty("java.security.krb5.conf", krb5confPath);
+ SYSTEM_PROPERTY_SETTER.setSystemProperty("java.security.krb5.realm", null);
+ SYSTEM_PROPERTY_SETTER.setSystemProperty("java.security.krb5.kdc", null);
+
final KerberosPrincipal servicePrincipal =
new KerberosPrincipal(LDAP_SERVICE_NAME + "/" + HOSTNAME + "@" + REALM,
KerberosPrincipal.KRB_NT_SRV_HST);
@@ -387,9 +396,6 @@
ldapServer.setSaslPrincipal(servicePrincipalName);
ldapServer.setSearchBaseDn(USERS_DN);
- final String krb5confPath = createKrb5Conf(kdcServer.getTransports()[0].getPort());
- SYSTEM_PROPERTY_SETTER.setSystemProperty("java.security.krb5.conf", krb5confPath);
-
createPrincipal("KDC", "KDC", "krbtgt", UUID.randomUUID().toString(), "krbtgt/" + REALM + "@" + REALM);
createPrincipal("Service", "LDAP Service", "ldap", UUID.randomUUID().toString(), servicePrincipalName);
}
@@ -410,6 +416,9 @@
final String config = String.format("[libdefaults]%1$s"
+ " default_realm = %2$s%1$s"
+ " udp_preference_limit = 1%1$s"
+ + " default_tkt_enctypes = aes128-cts-hmac-sha1-96 rc4-hmac%1$s"
+ + " default_tgs_enctypes = aes128-cts-hmac-sha1-96 rc4-hmac%1$s"
+ + " permitted_enctypes = aes128-cts-hmac-sha1-96 rc4-hmac%1$s"
+ "[realms]%1$s"
+ " %2$s = {%1$s"
+ " kdc = %3$s%1$s"