HADOOP-10393. Fix the javac warnings in hadoop-auth.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1575470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b1304d098
commit
b7428fe63d
@ -313,7 +313,7 @@ public Void run() throws Exception {
|
|||||||
/*
|
/*
|
||||||
* Sends the Kerberos token to the server.
|
* Sends the Kerberos token to the server.
|
||||||
*/
|
*/
|
||||||
private void sendToken(byte[] outToken) throws IOException, AuthenticationException {
|
private void sendToken(byte[] outToken) throws IOException {
|
||||||
String token = base64.encodeToString(outToken);
|
String token = base64.encodeToString(outToken);
|
||||||
conn = (HttpURLConnection) url.openConnection();
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
if (connConfigurator != null) {
|
if (connConfigurator != null) {
|
||||||
|
@ -57,7 +57,7 @@ public void testFallbacktoPseudoAuthenticator() throws Exception {
|
|||||||
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");
|
||||||
auth.setAuthenticationHandlerConfig(props);
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(props);
|
||||||
auth._testAuthentication(new KerberosAuthenticator(), false);
|
auth._testAuthentication(new KerberosAuthenticator(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,14 +67,14 @@ public void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception {
|
|||||||
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");
|
||||||
auth.setAuthenticationHandlerConfig(props);
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(props);
|
||||||
auth._testAuthentication(new KerberosAuthenticator(), false);
|
auth._testAuthentication(new KerberosAuthenticator(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout=60000)
|
@Test(timeout=60000)
|
||||||
public void testNotAuthenticated() throws Exception {
|
public void testNotAuthenticated() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
||||||
auth.start();
|
auth.start();
|
||||||
try {
|
try {
|
||||||
URL url = new URL(auth.getBaseURL());
|
URL url = new URL(auth.getBaseURL());
|
||||||
@ -90,7 +90,7 @@ public void testNotAuthenticated() throws Exception {
|
|||||||
@Test(timeout=60000)
|
@Test(timeout=60000)
|
||||||
public void testAuthentication() throws Exception {
|
public void testAuthentication() throws Exception {
|
||||||
final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration());
|
getAuthenticationHandlerConfiguration());
|
||||||
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
@ -104,7 +104,7 @@ public Void call() throws Exception {
|
|||||||
@Test(timeout=60000)
|
@Test(timeout=60000)
|
||||||
public void testAuthenticationPost() throws Exception {
|
public void testAuthenticationPost() throws Exception {
|
||||||
final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
final AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration());
|
getAuthenticationHandlerConfiguration());
|
||||||
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
KerberosTestUtils.doAsClient(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ public void testGetUserName() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAnonymousAllowed() throws Exception {
|
public void testAnonymousAllowed() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(true));
|
getAuthenticationHandlerConfiguration(true));
|
||||||
auth.start();
|
auth.start();
|
||||||
try {
|
try {
|
||||||
@ -56,7 +56,7 @@ public void testAnonymousAllowed() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAnonymousDisallowed() throws Exception {
|
public void testAnonymousDisallowed() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(false));
|
getAuthenticationHandlerConfiguration(false));
|
||||||
auth.start();
|
auth.start();
|
||||||
try {
|
try {
|
||||||
@ -72,7 +72,7 @@ public void testAnonymousDisallowed() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAuthenticationAnonymousAllowed() throws Exception {
|
public void testAuthenticationAnonymousAllowed() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(true));
|
getAuthenticationHandlerConfiguration(true));
|
||||||
auth._testAuthentication(new PseudoAuthenticator(), false);
|
auth._testAuthentication(new PseudoAuthenticator(), false);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public void testAuthenticationAnonymousAllowed() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAuthenticationAnonymousDisallowed() throws Exception {
|
public void testAuthenticationAnonymousDisallowed() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(false));
|
getAuthenticationHandlerConfiguration(false));
|
||||||
auth._testAuthentication(new PseudoAuthenticator(), false);
|
auth._testAuthentication(new PseudoAuthenticator(), false);
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ public void testAuthenticationAnonymousDisallowed() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAuthenticationAnonymousAllowedWithPost() throws Exception {
|
public void testAuthenticationAnonymousAllowedWithPost() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(true));
|
getAuthenticationHandlerConfiguration(true));
|
||||||
auth._testAuthentication(new PseudoAuthenticator(), true);
|
auth._testAuthentication(new PseudoAuthenticator(), true);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public void testAuthenticationAnonymousAllowedWithPost() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testAuthenticationAnonymousDisallowedWithPost() throws Exception {
|
public void testAuthenticationAnonymousDisallowedWithPost() throws Exception {
|
||||||
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
AuthenticatorTestCase auth = new AuthenticatorTestCase();
|
||||||
auth.setAuthenticationHandlerConfig(
|
AuthenticatorTestCase.setAuthenticationHandlerConfig(
|
||||||
getAuthenticationHandlerConfiguration(false));
|
getAuthenticationHandlerConfiguration(false));
|
||||||
auth._testAuthentication(new PseudoAuthenticator(), true);
|
auth._testAuthentication(new PseudoAuthenticator(), true);
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.hadoop.security.authentication.server;
|
package org.apache.hadoop.security.authentication.server;
|
||||||
|
|
||||||
import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
|
import java.io.IOException;
|
||||||
import org.apache.hadoop.security.authentication.client.AuthenticationException;
|
import java.util.Arrays;
|
||||||
import org.apache.hadoop.security.authentication.util.Signer;
|
import java.util.HashMap;
|
||||||
import org.junit.Assert;
|
import java.util.Properties;
|
||||||
import org.junit.Test;
|
import java.util.Vector;
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
@ -31,8 +27,15 @@
|
|||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
|
||||||
|
import org.apache.hadoop.security.authentication.client.AuthenticationException;
|
||||||
|
import org.apache.hadoop.security.authentication.util.Signer;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
public class TestAuthenticationFilter {
|
public class TestAuthenticationFilter {
|
||||||
|
|
||||||
|
@ -411,6 +411,8 @@ Release 2.4.0 - UNRELEASED
|
|||||||
HADOOP-10353. FsUrlStreamHandlerFactory is not thread safe.
|
HADOOP-10353. FsUrlStreamHandlerFactory is not thread safe.
|
||||||
(Tudor Scurtu via cnauroth)
|
(Tudor Scurtu via cnauroth)
|
||||||
|
|
||||||
|
HADOOP-10393. Fix the javac warnings in hadoop-auth. (szetszwo)
|
||||||
|
|
||||||
BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
|
BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
|
||||||
|
|
||||||
HADOOP-10185. FileSystem API for ACLs. (cnauroth)
|
HADOOP-10185. FileSystem API for ACLs. (cnauroth)
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
import org.apache.directory.server.kerberos.shared.keytab.KeytabEntry;
|
import org.apache.directory.server.kerberos.shared.keytab.KeytabEntry;
|
||||||
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
|
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
|
||||||
import org.apache.directory.server.protocol.shared.transport.UdpTransport;
|
import org.apache.directory.server.protocol.shared.transport.UdpTransport;
|
||||||
|
import org.apache.directory.server.xdbm.Index;
|
||||||
import org.apache.directory.shared.kerberos.KerberosTime;
|
import org.apache.directory.shared.kerberos.KerberosTime;
|
||||||
import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
|
import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
|
||||||
import org.apache.directory.shared.kerberos.components.EncryptionKey;
|
import org.apache.directory.shared.kerberos.components.EncryptionKey;
|
||||||
@ -134,7 +135,7 @@ public static void main(String[] args) throws Exception {
|
|||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry entry : userConf.entrySet()) {
|
for (Map.Entry<?, ?> entry : userConf.entrySet()) {
|
||||||
conf.put(entry.getKey(), entry.getValue());
|
conf.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
final MiniKdc miniKdc = new MiniKdc(conf, workDir);
|
final MiniKdc miniKdc = new MiniKdc(conf, workDir);
|
||||||
@ -250,7 +251,7 @@ public MiniKdc(Properties conf, File workDir) throws Exception {
|
|||||||
}
|
}
|
||||||
LOG.info("Configuration:");
|
LOG.info("Configuration:");
|
||||||
LOG.info("---------------------------------------------------------------");
|
LOG.info("---------------------------------------------------------------");
|
||||||
for (Map.Entry entry : conf.entrySet()) {
|
for (Map.Entry<?, ?> entry : conf.entrySet()) {
|
||||||
LOG.info(" {}: {}", entry.getKey(), entry.getValue());
|
LOG.info(" {}: {}", entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
LOG.info("---------------------------------------------------------------");
|
LOG.info("---------------------------------------------------------------");
|
||||||
@ -311,7 +312,6 @@ public synchronized void start() throws Exception {
|
|||||||
initKDCServer();
|
initKDCServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void initDirectoryService() throws Exception {
|
private void initDirectoryService() throws Exception {
|
||||||
ds = new DefaultDirectoryService();
|
ds = new DefaultDirectoryService();
|
||||||
ds.setInstanceLayout(new InstanceLayout(workDir));
|
ds.setInstanceLayout(new InstanceLayout(workDir));
|
||||||
@ -364,7 +364,7 @@ private void initDirectoryService() throws Exception {
|
|||||||
partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
|
partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
|
||||||
ds.addPartition(partition);
|
ds.addPartition(partition);
|
||||||
// indexes
|
// indexes
|
||||||
Set indexedAttributes = new HashSet();
|
Set<Index<?, ?, String>> indexedAttributes = new HashSet<Index<?, ?, String>>();
|
||||||
indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
|
indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
|
||||||
indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
|
indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
|
||||||
indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
|
indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
|
||||||
@ -398,9 +398,13 @@ private void initKDCServer() throws Exception {
|
|||||||
SchemaManager schemaManager = ds.getSchemaManager();
|
SchemaManager schemaManager = ds.getSchemaManager();
|
||||||
final String content = StrSubstitutor.replace(IOUtils.toString(is), map);
|
final String content = StrSubstitutor.replace(IOUtils.toString(is), map);
|
||||||
LdifReader reader = new LdifReader(new StringReader(content));
|
LdifReader reader = new LdifReader(new StringReader(content));
|
||||||
for (LdifEntry ldifEntry : reader) {
|
try {
|
||||||
ds.getAdminSession().add(new DefaultEntry(schemaManager,
|
for (LdifEntry ldifEntry : reader) {
|
||||||
ldifEntry.getEntry()));
|
ds.getAdminSession().add(new DefaultEntry(schemaManager,
|
||||||
|
ldifEntry.getEntry()));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
reader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
kdc = new KdcServer();
|
kdc = new KdcServer();
|
||||||
|
Loading…
Reference in New Issue
Block a user