Review Board 1.7.22


SQOOP-1223 Enhance the password file capability to enable plugging-in custom loaders

Review Request #15192 - Created Nov. 2, 2013 and updated

Jarek Cecho
SQOOP-1223
Reviewers
Sqoop
sqoop-trunk
I've changed the logic of loading passwords from password file to enable plugging in custom loader. I've also provided example implementation of advanced loader that is able to retrieve the password from encrypted file.
Added unit tests that is testing all out-of-the-box available ECB methods in Java.
src/java/org/apache/sqoop/SqoopOptions.java
Revision 13637b5ef8ddbaa3ac7bbbf920ff24d98b29127f New Change
[20] 610 lines
[+20] [+] public void loadProperties(Properties props) {
611

    
   
611

   
612
  private void loadPasswordProperty(Properties props) {
612
  private void loadPasswordProperty(Properties props) {
613
    passwordFilePath = props.getProperty("db.password.file");
613
    passwordFilePath = props.getProperty("db.password.file");
614
    if (passwordFilePath != null) {
614
    if (passwordFilePath != null) {
615
      try {
615
      try {
616
        password = CredentialsUtil.fetchPasswordFromFile(
616
        password = CredentialsUtil.fetchPasswordFromLoader(passwordFilePath, getConf());
617
                getConf(), passwordFilePath);

   
618
        return; // short-circuit
617
        return; // short-circuit
619
      } catch (IOException e) {
618
      } catch (IOException e) {
620
        throw new RuntimeException("Unable to fetch password from file.", e);
619
        throw new RuntimeException("Unable to fetch password from file.", e);
621
      }
620
      }
622
    }
621
    }
[+20] [20] 1588 lines
src/java/org/apache/sqoop/tool/BaseSqoopTool.java
Revision 9230f82d8727de5e1d97b2846bead230f4d09abd New Change
 
src/java/org/apache/sqoop/util/CredentialsUtil.java
Revision 64124693a74ee01fcfcef9f637d60288262ba8f2 New Change
 
src/java/org/apache/sqoop/util/password/CryptoFileLoader.java
New File
 
src/java/org/apache/sqoop/util/password/FilePasswordLoader.java
New File
 
src/java/org/apache/sqoop/util/password/PasswordLoader.java
New File
 
src/test/org/apache/sqoop/credentials/TestPassingSecurePassword.java
Revision 41a432a6138f7b92dec0d91180a1cd3de9a8b499 New Change
 
  1. src/java/org/apache/sqoop/SqoopOptions.java: Loading...
  2. src/java/org/apache/sqoop/tool/BaseSqoopTool.java: Loading...
  3. src/java/org/apache/sqoop/util/CredentialsUtil.java: Loading...
  4. src/java/org/apache/sqoop/util/password/CryptoFileLoader.java: Loading...
  5. src/java/org/apache/sqoop/util/password/FilePasswordLoader.java: Loading...
  6. src/java/org/apache/sqoop/util/password/PasswordLoader.java: Loading...
  7. src/test/org/apache/sqoop/credentials/TestPassingSecurePassword.java: Loading...