You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2016/11/18 08:39:51 UTC

svn commit: r1770332 - /directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java

Author: seelmann
Date: Fri Nov 18 08:39:51 2016
New Revision: 1770332

URL: http://svn.apache.org/viewvc?rev=1770332&view=rev
Log:
Add next Kerberos/GSSAPI authentication test that uses native TGT

Modified:
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java?rev=1770332&r1=1770331&r2=1770332&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java Fri Nov 18 08:39:51 2016
@@ -22,6 +22,7 @@ package org.apache.directory.studio.test
 
 
 import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
 import java.io.File;
@@ -137,7 +138,7 @@ public class GssApiTest
 
 
     @Test
-    public void testGssApiObtainTgtAndObtainServiceTicket() throws Exception
+    public void testGssApiObtainTgtAndUseManualConfigurationAndObtainServiceTicket() throws Exception
     {
         // create the server
         createServer( serverName );
@@ -153,12 +154,6 @@ public class GssApiTest
         connectionsViewBot.createTestConnection( "GssApiTest", ldapPort );
         importData();
 
-        // restart ApacheDS
-        // serversViewBot.stopServer( serverName );
-        // serversViewBot.waitForServerStop( serverName );
-        // serversViewBot.runServer( serverName );
-        // serversViewBot.waitForServerStart( serverName );
-
         // connect with GSSAPI authentication
         NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
         wizardBot.typeConnectionName( getConnectionName() );
@@ -182,6 +177,49 @@ public class GssApiTest
     }
 
 
+    @Test
+    public void testGssApiUseNativeTgtAndNativeConfigurationAndObtainServiceTicket() throws Exception
+    {
+        // create the server
+        createServer( serverName );
+
+        // configure ApacheDS and KDC server
+        configureApacheDS( serverName );
+
+        // start ApacheDS
+        serversViewBot.runServer( serverName );
+        serversViewBot.waitForServerStart( serverName );
+
+        // import KDC data
+        connectionsViewBot.createTestConnection( "GssApiTest", ldapPort );
+        importData();
+
+        // obtain native TGT
+        String[] cmd =
+            { "/bin/sh", "-c", "echo secret | /usr/bin/kinit hnelson" };
+        Process process = Runtime.getRuntime().exec( cmd );
+        int exitCode = process.waitFor();
+        assertEquals( 0, exitCode );
+
+        // connect with GSSAPI authentication
+        NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
+        wizardBot.typeConnectionName( getConnectionName() );
+        wizardBot.typeHost( LOCALHOST );
+        wizardBot.typePort( ldapPort );
+        wizardBot.selectJndiProvider();
+        wizardBot.clickNextButton();
+        wizardBot.selectGssApiAuthentication();
+        wizardBot.selectUserNativeTgt();
+        wizardBot.selectUseNativeSystemConfiguration();
+
+        // check the connection
+        String result = wizardBot.clickCheckAuthenticationButton();
+        assertNull( "Expected OK", result );
+
+        wizardBot.clickCancelButton();
+    }
+
+
     private static void createServer( String serverName )
     {
         // Showing view
@@ -207,6 +245,7 @@ public class GssApiTest
         editorBot.enableKerberosServer();
 
         editorBot.setAvailablePorts();
+        editorBot.setKerberosPort( 60088 );
         ldapPort = editorBot.getLdapPort();
         kdcPort = editorBot.getKerberosPort();
 
@@ -225,7 +264,7 @@ public class GssApiTest
     private void importData() throws IOException
     {
         URL url = Platform.getInstanceLocation().getURL();
-        String destFile = url.getFile() + "GssApiTest.ldif";
+        String destFile = url.getFile() + "GssApiTest_" + System.currentTimeMillis() + ".ldif";
         InputStream is = getClass().getResourceAsStream( "GssApiTest.ldif" );
         String ldifContent = IOUtils.toString( is, StandardCharsets.UTF_8 );
         ldifContent = ldifContent.replace( "HOSTNAME", Constants.LOCALHOST );