From 39ab0a6f254f6c47282db44f240c78472f03b19f Mon Sep 17 00:00:00 2001 From: Jarek Jarcec Cecho Date: Thu, 20 Nov 2014 20:16:07 -0800 Subject: [PATCH] SQOOP-1774: Sqoop2: Allow anonymous authentication (Abraham Elmahrek via Jarek Jarcec Cecho) --- .../org/apache/sqoop/security/AuthenticationConstants.java | 7 +++++++ dist/src/main/server/conf/sqoop.properties | 1 + .../org/apache/sqoop/filter/SqoopAuthenticationFilter.java | 2 ++ 3 files changed, 10 insertions(+) diff --git a/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java b/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java index 26f83a94..f37e5058 100644 --- a/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java +++ b/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java @@ -47,6 +47,13 @@ public final class AuthenticationConstants { public static final String AUTHENTICATION_HANDLER = PREFIX_AUTHENTICATION_CONFIG + "handler"; + /** + * The config enables or disables anonymous authentication. + * org.apache.sqoop.authentication.anonymous. + */ + public static final String AUTHENTICATION_ANONYMOUS = + PREFIX_AUTHENTICATION_CONFIG + "anonymous"; + /** * All kerberos authentication related configuration is prefixed with this: * org.apache.sqoop.authentication.kerberos. diff --git a/dist/src/main/server/conf/sqoop.properties b/dist/src/main/server/conf/sqoop.properties index 1666283a..3d18e7bc 100755 --- a/dist/src/main/server/conf/sqoop.properties +++ b/dist/src/main/server/conf/sqoop.properties @@ -146,6 +146,7 @@ org.apache.sqoop.execution.engine=org.apache.sqoop.execution.mapreduce.Mapreduce # org.apache.sqoop.authentication.type=SIMPLE org.apache.sqoop.authentication.handler=org.apache.sqoop.security.SimpleAuthenticationHandler +#org.apache.sqoop.anonymous=true #org.apache.sqoop.authentication.type=KERBEROS #org.apache.sqoop.authentication.handler=org.apache.sqoop.security.KerberosAuthenticationHandler #org.apache.sqoop.authentication.kerberos.principal=sqoop/_HOST@NOVALOCAL diff --git a/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java b/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java index a6a79d38..4165b866 100644 --- a/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java +++ b/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java @@ -71,6 +71,8 @@ protected Properties getConfiguration(String configPrefix, properties.setProperty(KerberosAuthenticationHandler.KEYTAB, keytab); } else if (type.equalsIgnoreCase(AuthenticationConstants.TYPE.SIMPLE.name())) { properties.setProperty(AUTH_TYPE, PseudoAuthenticationHandler.class.getName()); + properties.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, + mapContext.getString(AuthenticationConstants.AUTHENTICATION_ANONYMOUS, "true").trim()); } else { throw new SqoopException(AuthenticationError.AUTH_0004, type); }