You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by co...@apache.org on 2021/05/11 09:04:39 UTC
[directory-server] branch master updated: Re-enabled a SASL test
using Apache Kerby.
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git
The following commit(s) were added to refs/heads/master by this push:
new f784540 Re-enabled a SASL test using Apache Kerby.
f784540 is described below
commit f7845409d6cea873ead4a038338d2f73a8796f6c
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue May 11 09:44:39 2021 +0100
Re-enabled a SASL test using Apache Kerby.
---
pom.xml | 13 +++++++++
server-integ/pom.xml | 14 ++++++++++
.../server/operations/bind/SaslBindIT.java | 32 +++++++++++++++++++---
3 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6101d31..0e4adaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
<junit.jupiter.version>5.7.0</junit.jupiter.version>
<junit.jupiter.api.version>5.7.0</junit.jupiter.api.version>
<junit.platform.version>1.7.0-RC1</junit.platform.version>
+ <kerby.version>2.0.1</kerby.version>
<ldapsdk.version>4.1</ldapsdk.version>
<log4j.version>1.2.17</log4j.version>
<logback.version>1.2.3</logback.version>
@@ -1187,6 +1188,18 @@
<version>${logback.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.kerby</groupId>
+ <artifactId>kerb-simplekdc</artifactId>
+ <version>${kerby.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.kerby</groupId>
+ <artifactId>kerby-kdc</artifactId>
+ <version>${kerby.version}</version>
+ </dependency>
+
<!-- Logging dependencies -->
<dependency>
diff --git a/server-integ/pom.xml b/server-integ/pom.xml
index a1aeca8..d396ac1 100644
--- a/server-integ/pom.xml
+++ b/server-integ/pom.xml
@@ -172,6 +172,20 @@
<groupId>org.apache.directory.api</groupId>
<artifactId>api-dsml-engine</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.kerby</groupId>
+ <artifactId>kerb-simplekdc</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.kerby</groupId>
+ <artifactId>kerby-kdc</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
</dependencies>
<build>
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
index 6f1f4d0..6e27ec9 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.File;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.util.Locale;
@@ -77,6 +78,8 @@ import org.apache.directory.server.ldap.handlers.sasl.gssapi.GssapiMechanismHand
import org.apache.directory.server.ldap.handlers.sasl.ntlm.NtlmMechanismHandler;
import org.apache.directory.server.ldap.handlers.sasl.plain.PlainMechanismHandler;
import org.apache.directory.shared.kerberos.KerberosAttribute;
+import org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl;
+import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
@@ -467,10 +470,31 @@ public class SaslBindIT extends AbstractLdapTestUnit
/**
* Tests to make sure GSS-API binds below the RootDSE work.
+ */
@Test
- @Disabled
public void testSaslGssApiBind() throws Exception
{
+ SimpleKdcServer kerbyServer = new SimpleKdcServer();
+
+ String basedir = System.getProperty( "basedir" );
+ if (basedir == null) {
+ basedir = new File( "." ).getCanonicalPath();
+ }
+
+ kerbyServer.setKdcRealm( "EXAMPLE.COM" );
+ kerbyServer.setAllowUdp( true );
+ kerbyServer.setWorkDir( new File( basedir + "/target" ) );
+
+ kerbyServer.setInnerKdcImpl( new NettyKdcServerImpl( kerbyServer.getKdcSetting() ) );
+ kerbyServer.init();
+
+ // Create principals
+ String hnelson = "hnelson@EXAMPLE.COM";
+ String ldap = "ldap/" + Network.LOOPBACK_HOSTNAME + "@EXAMPLE.COM";
+ kerbyServer.createPrincipal( hnelson, "secret");
+ kerbyServer.createPrincipal( ldap, "randall" );
+ kerbyServer.start();
+
Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
LdapNetworkConnection connection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, getLdapServer().getPort() );
@@ -481,7 +505,7 @@ public class SaslBindIT extends AbstractLdapTestUnit
request.setCredentials( "secret" );
request.setRealmName( ldapServer.getSaslRealms().get( 0 ).toUpperCase( Locale.ROOT ) );
request.setKdcHost( Network.LOOPBACK_HOSTNAME );
- request.setKdcPort( 6088 );
+ request.setKdcPort( kerbyServer.getKdcPort() );
BindResponse resp = connection.bind( request );
assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
@@ -489,9 +513,9 @@ public class SaslBindIT extends AbstractLdapTestUnit
assertEquals( "hnelson", entry.get( "uid" ).getString() );
connection.close();
- }
- */
+ kerbyServer.stop();
+ }
/**
* Tests to make sure GSS-API binds below the RootDSE fail if the realm is bad.