You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dr...@apache.org on 2015/07/04 06:03:49 UTC
directory-kerby git commit: Moved login tests out of integration test
module
Repository: directory-kerby
Updated Branches:
refs/heads/master 88f349c0e -> d3e4ebcf4
Moved login tests out of integration test module
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/d3e4ebcf
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/d3e4ebcf
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/d3e4ebcf
Branch: refs/heads/master
Commit: d3e4ebcf4177b7d3927a10016b7b6a6d2f0ba9e7
Parents: 88f349c
Author: drankye <ka...@intel.com>
Authored: Sat Jul 4 11:58:21 2015 +0800
Committer: Drankye <dr...@gmail.com>
Committed: Sat Jul 4 12:02:05 2015 +0800
----------------------------------------------------------------------
kerby-backend/pom.xml | 1 -
.../kerb/integration/test/KeytabLoginTest.java | 30 -------
.../kerb/integration/test/LoginTestBase.java | 85 --------------------
.../integration/test/PasswordLoginTest.java | 31 -------
.../integration/test/TicketCacheLoginTest.java | 30 -------
.../kerberos/kerb/server/KeytabLoginTest.java | 30 +++++++
.../kerberos/kerb/server/LoginTestBase.java | 85 ++++++++++++++++++++
.../kerberos/kerb/server/PasswordLoginTest.java | 31 +++++++
.../kerb/server/TicketCacheLoginTest.java | 30 +++++++
9 files changed, 176 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-backend/pom.xml b/kerby-backend/pom.xml
index d8c07a4..2ad0838 100644
--- a/kerby-backend/pom.xml
+++ b/kerby-backend/pom.xml
@@ -29,7 +29,6 @@
<modules>
<module>ldap-backend</module>
<module>json-backend</module>
- <module>mavibot</module>
<module>zookeeper-backend</module>
</modules>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/KeytabLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/KeytabLoginTest.java b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/KeytabLoginTest.java
deleted file mode 100644
index 8d26035..0000000
--- a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/KeytabLoginTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.integration.test;
-
-import org.junit.Test;
-
-public class KeytabLoginTest extends LoginTestBase {
-
- @Test
- public void testLogin() throws Exception {
- checkSubject(super.loginServiceUsingKeytab());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/LoginTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/LoginTestBase.java b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/LoginTestBase.java
deleted file mode 100644
index db517b1..0000000
--- a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/LoginTestBase.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.integration.test;
-
-import org.apache.kerby.kerberos.kerb.client.JaasKrbUtil;
-import org.apache.kerby.kerberos.kerb.server.KdcTestBase;
-import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
-import org.junit.After;
-import org.junit.Before;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
-import java.io.File;
-import java.security.Principal;
-import java.util.Set;
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-public class LoginTestBase extends KdcTestBase {
-
- protected File ticketCacheFile;
- protected File serviceKeytabFile;
-
- @Before
- @Override
- public void setUp() throws Exception {
- super.setUp();
-
- ticketCacheFile = new File(getTestDir(), "test-tkt.cc");
- serviceKeytabFile = new File(getTestDir(), "test-service.keytab");
- }
-
- protected Subject loginClientUsingPassword() throws LoginException {
- return JaasKrbUtil.loginUsingPassword(getClientPrincipal(),
- getClientPassword());
- }
-
- protected Subject loginClientUsingTicketCache() throws Exception {
- TgtTicket tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(),
- getClientPassword());
- getKrbClient().storeTicket(tgt, ticketCacheFile);
-
- return JaasKrbUtil.loginUsingTicketCache(getClientPrincipal(),
- ticketCacheFile);
- }
-
- protected Subject loginServiceUsingKeytab() throws Exception {
- getKdcServer().exportPrincipals(serviceKeytabFile);
-
- return JaasKrbUtil.loginUsingKeytab(getClientPrincipal(),
- serviceKeytabFile);
- }
-
- protected void checkSubject(Subject subject) {
-
- Set<Principal> clientPrincipals = subject.getPrincipals();
- assertThat(clientPrincipals);
- }
-
- @After
- @Override
- public void tearDown() throws Exception {
- ticketCacheFile.delete();
- serviceKeytabFile.delete();
-
- super.tearDown();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/PasswordLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/PasswordLoginTest.java b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/PasswordLoginTest.java
deleted file mode 100644
index 6c2e4f3..0000000
--- a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/PasswordLoginTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.integration.test;
-
-import org.junit.Test;
-
-public class PasswordLoginTest extends LoginTestBase {
-
- @Test
- public void testLogin() throws Exception {
- checkSubject(super.loginClientUsingPassword());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TicketCacheLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TicketCacheLoginTest.java b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TicketCacheLoginTest.java
deleted file mode 100644
index a7c198c..0000000
--- a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TicketCacheLoginTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.integration.test;
-
-import org.junit.Test;
-
-public class TicketCacheLoginTest extends LoginTestBase {
-
- @Test
- public void testLogin() throws Exception {
- checkSubject(super.loginClientUsingTicketCache());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KeytabLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KeytabLoginTest.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KeytabLoginTest.java
new file mode 100644
index 0000000..3210e8b
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KeytabLoginTest.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.junit.Test;
+
+public class KeytabLoginTest extends LoginTestBase {
+
+ @Test
+ public void testLogin() throws Exception {
+ checkSubject(super.loginServiceUsingKeytab());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
new file mode 100644
index 0000000..a7d2dc6
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.apache.kerby.kerberos.kerb.client.JaasKrbUtil;
+import org.apache.kerby.kerberos.kerb.server.KdcTestBase;
+import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
+import org.junit.After;
+import org.junit.Before;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import java.io.File;
+import java.security.Principal;
+import java.util.Set;
+import static org.assertj.core.api.Assertions.assertThat;
+
+
+public class LoginTestBase extends KdcTestBase {
+
+ protected File ticketCacheFile;
+ protected File serviceKeytabFile;
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ ticketCacheFile = new File(getTestDir(), "test-tkt.cc");
+ serviceKeytabFile = new File(getTestDir(), "test-service.keytab");
+ }
+
+ protected Subject loginClientUsingPassword() throws LoginException {
+ return JaasKrbUtil.loginUsingPassword(getClientPrincipal(),
+ getClientPassword());
+ }
+
+ protected Subject loginClientUsingTicketCache() throws Exception {
+ TgtTicket tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(),
+ getClientPassword());
+ getKrbClient().storeTicket(tgt, ticketCacheFile);
+
+ return JaasKrbUtil.loginUsingTicketCache(getClientPrincipal(),
+ ticketCacheFile);
+ }
+
+ protected Subject loginServiceUsingKeytab() throws Exception {
+ getKdcServer().exportPrincipals(serviceKeytabFile);
+
+ return JaasKrbUtil.loginUsingKeytab(getClientPrincipal(),
+ serviceKeytabFile);
+ }
+
+ protected void checkSubject(Subject subject) {
+
+ Set<Principal> clientPrincipals = subject.getPrincipals();
+ assertThat(clientPrincipals);
+ }
+
+ @After
+ @Override
+ public void tearDown() throws Exception {
+ ticketCacheFile.delete();
+ serviceKeytabFile.delete();
+
+ super.tearDown();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/PasswordLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/PasswordLoginTest.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/PasswordLoginTest.java
new file mode 100644
index 0000000..8eb00d3
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/PasswordLoginTest.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.junit.Test;
+
+public class PasswordLoginTest extends LoginTestBase {
+
+ @Test
+ public void testLogin() throws Exception {
+ checkSubject(super.loginClientUsingPassword());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/d3e4ebcf/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TicketCacheLoginTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TicketCacheLoginTest.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TicketCacheLoginTest.java
new file mode 100644
index 0000000..0da3705
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TicketCacheLoginTest.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.junit.Test;
+
+public class TicketCacheLoginTest extends LoginTestBase {
+
+ @Test
+ public void testLogin() throws Exception {
+ checkSubject(super.loginClientUsingTicketCache());
+ }
+}
\ No newline at end of file