SQOOP-1774: Sqoop2: Allow anonymous authentication
(Abraham Elmahrek via Jarek Jarcec Cecho)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/b9786afc
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/b9786afc
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/b9786afc
Branch: refs/heads/cdh5-1.99.4
Commit: b9786afcd539def10c268a49b12f4cec2d426d66
Parents: 5d0862f
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Nov 20 20:16:07 2014 -0800
Committer: Abraham Elmahrek <abraham@elmahrek.com>
Committed: Fri Nov 21 17:43:13 2014 -0800
----------------------------------------------------------------------
.../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(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/b9786afc/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java
----------------------------------------------------------------------
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 26f83a9..f37e505 100644
--- a/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java
+++ b/core/src/main/java/org/apache/sqoop/security/AuthenticationConstants.java
@@ -48,6 +48,13 @@ public final class AuthenticationConstants {
PREFIX_AUTHENTICATION_CONFIG + "handler";
/**
+ * The config enables or disables anonymous authentication.
+ * <tt>org.apache.sqoop.authentication.anonymous</tt>.
+ */
+ public static final String AUTHENTICATION_ANONYMOUS =
+ PREFIX_AUTHENTICATION_CONFIG + "anonymous";
+
+ /**
* All kerberos authentication related configuration is prefixed with this:
* <tt>org.apache.sqoop.authentication.kerberos.</tt>
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/b9786afc/dist/src/main/server/conf/sqoop.properties
----------------------------------------------------------------------
diff --git a/dist/src/main/server/conf/sqoop.properties b/dist/src/main/server/conf/sqoop.properties
index 1666283..3d18e7b 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
http://git-wip-us.apache.org/repos/asf/sqoop/blob/b9786afc/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java
----------------------------------------------------------------------
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 a6a79d3..4165b86 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 @@ public class SqoopAuthenticationFilter extends AuthenticationFilter {
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);
}
|