|
@@ -28,33 +28,20 @@ import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHand
|
|
import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
|
|
import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
|
|
import org.junit.Assert;
|
|
import org.junit.Assert;
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
-import org.junit.runners.Parameterized;
|
|
|
|
-import org.junit.runner.RunWith;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Collection;
|
|
|
|
import java.util.Properties;
|
|
import java.util.Properties;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
|
-@RunWith(Parameterized.class)
|
|
|
|
|
|
+/**
|
|
|
|
+ * Test class for {@link KerberosAuthenticator}.
|
|
|
|
+ */
|
|
public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
- private boolean useTomcat = false;
|
|
|
|
-
|
|
|
|
- public TestKerberosAuthenticator(boolean useTomcat) {
|
|
|
|
- this.useTomcat = useTomcat;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Parameterized.Parameters
|
|
|
|
- public static Collection booleans() {
|
|
|
|
- return Arrays.asList(new Object[][] {
|
|
|
|
- { false },
|
|
|
|
- { true }
|
|
|
|
- });
|
|
|
|
|
|
+ public TestKerberosAuthenticator() {
|
|
}
|
|
}
|
|
|
|
|
|
@Before
|
|
@Before
|
|
@@ -93,7 +80,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testFallbacktoPseudoAuthenticator() throws Exception {
|
|
public void testFallbacktoPseudoAuthenticator() throws Exception {
|
|
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
Properties props = new Properties();
|
|
Properties props = new Properties();
|
|
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
|
|
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
|
|
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false");
|
|
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false");
|
|
@@ -103,7 +90,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception {
|
|
public void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception {
|
|
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
Properties props = new Properties();
|
|
Properties props = new Properties();
|
|
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
|
|
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
|
|
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true");
|
|
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true");
|
|
@@ -113,7 +100,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testNotAuthenticated() throws Exception {
|
|
public void testNotAuthenticated() throws Exception {
|
|
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
|
auth.start();
|
|
auth.start();
|
|
try {
|
|
try {
|
|
@@ -129,7 +116,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testAuthentication() throws Exception {
|
|
public void testAuthentication() throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
getAuthenticationHandlerConfiguration());
|
|
getAuthenticationHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
@@ -143,7 +130,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testAuthenticationPost() throws Exception {
|
|
public void testAuthenticationPost() throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
getAuthenticationHandlerConfiguration());
|
|
getAuthenticationHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
@@ -157,7 +144,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testAuthenticationHttpClient() throws Exception {
|
|
public void testAuthenticationHttpClient() throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
getAuthenticationHandlerConfiguration());
|
|
getAuthenticationHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
@@ -171,7 +158,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout=60000)
|
|
@Test(timeout=60000)
|
|
public void testAuthenticationHttpClientPost() throws Exception {
|
|
public void testAuthenticationHttpClientPost() throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
|
getAuthenticationHandlerConfiguration());
|
|
getAuthenticationHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
@@ -185,7 +172,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout = 60000)
|
|
@Test(timeout = 60000)
|
|
public void testNotAuthenticatedWithMultiAuthHandler() throws Exception {
|
|
public void testNotAuthenticatedWithMultiAuthHandler() throws Exception {
|
|
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase
|
|
AuthenticatorTestCase
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
auth.start();
|
|
auth.start();
|
|
@@ -204,7 +191,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
|
|
|
|
@Test(timeout = 60000)
|
|
@Test(timeout = 60000)
|
|
public void testAuthenticationWithMultiAuthHandler() throws Exception {
|
|
public void testAuthenticationWithMultiAuthHandler() throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase
|
|
AuthenticatorTestCase
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
@@ -219,7 +206,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
|
|
@Test(timeout = 60000)
|
|
@Test(timeout = 60000)
|
|
public void testAuthenticationHttpClientPostWithMultiAuthHandler()
|
|
public void testAuthenticationHttpClientPostWithMultiAuthHandler()
|
|
throws Exception {
|
|
throws Exception {
|
|
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
|
|
|
|
|
|
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
|
AuthenticatorTestCase
|
|
AuthenticatorTestCase
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|