5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 22:13:07 +08:00

SQOOP-1792: Sqoop2: Default to simple authentication type

(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2014-11-23 21:08:13 -08:00
parent ad35c19a1d
commit ae9c6e3542
3 changed files with 12 additions and 4 deletions

View File

@ -28,6 +28,11 @@ public class AuthenticationManager implements Reconfigurable {
private static final Logger LOG = Logger.getLogger(AuthenticationManager.class); private static final Logger LOG = Logger.getLogger(AuthenticationManager.class);
/**
* Default authentication handler
*/
public static final String DEFAULT_AUTHENTICATION_HANDLER = "org.apache.sqoop.security.SimpleAuthenticationHandler";
/** /**
* Default authentication auto upgrade option value * Default authentication auto upgrade option value
@ -86,7 +91,9 @@ public synchronized void initialize() throws ClassNotFoundException, IllegalAcce
LOG.trace("Begin authentication manager initialization"); LOG.trace("Begin authentication manager initialization");
} }
String handler = SqoopConfiguration.getInstance().getContext().getString(AuthenticationConstants.AUTHENTICATION_HANDLER.trim()); String handler = SqoopConfiguration.getInstance().getContext().getString(
AuthenticationConstants.AUTHENTICATION_HANDLER,
DEFAULT_AUTHENTICATION_HANDLER).trim();
authenticationHandler = AuthenticationHandlerFactory.getAuthenticationHandler(handler); authenticationHandler = AuthenticationHandlerFactory.getAuthenticationHandler(handler);
authenticationHandler.doInitialize(); authenticationHandler.doInitialize();
authenticationHandler.secureLogin(); authenticationHandler.secureLogin();

View File

@ -144,8 +144,8 @@ org.apache.sqoop.execution.engine=org.apache.sqoop.execution.mapreduce.Mapreduce
# #
# Authentication configuration # Authentication configuration
# #
org.apache.sqoop.authentication.type=SIMPLE #org.apache.sqoop.authentication.type=SIMPLE
org.apache.sqoop.authentication.handler=org.apache.sqoop.security.SimpleAuthenticationHandler #org.apache.sqoop.authentication.handler=org.apache.sqoop.security.SimpleAuthenticationHandler
#org.apache.sqoop.anonymous=true #org.apache.sqoop.anonymous=true
#org.apache.sqoop.authentication.type=KERBEROS #org.apache.sqoop.authentication.type=KERBEROS
#org.apache.sqoop.authentication.handler=org.apache.sqoop.security.KerberosAuthenticationHandler #org.apache.sqoop.authentication.handler=org.apache.sqoop.security.KerberosAuthenticationHandler

View File

@ -40,7 +40,8 @@ protected Properties getConfiguration(String configPrefix,
Properties properties = super.getConfiguration(configPrefix, filterConfig); Properties properties = super.getConfiguration(configPrefix, filterConfig);
MapContext mapContext = SqoopConfiguration.getInstance().getContext(); MapContext mapContext = SqoopConfiguration.getInstance().getContext();
String type = mapContext.getString( String type = mapContext.getString(
AuthenticationConstants.AUTHENTICATION_TYPE).trim(); AuthenticationConstants.AUTHENTICATION_TYPE,
AuthenticationConstants.TYPE.SIMPLE.name()).trim();
if (type.equalsIgnoreCase(AuthenticationConstants.TYPE.KERBEROS.name())) { if (type.equalsIgnoreCase(AuthenticationConstants.TYPE.KERBEROS.name())) {
properties.setProperty(AUTH_TYPE, AuthenticationConstants.TYPE.KERBEROS.name().toLowerCase()); properties.setProperty(AUTH_TYPE, AuthenticationConstants.TYPE.KERBEROS.name().toLowerCase());