You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2023/06/08 22:04:43 UTC

[accumulo] branch main updated (950306edd0 -> 447b2e5dba)

This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


    from 950306edd0 Merge branch '2.1'
     add 0f2389735f Modify Shell to authenticate user on call to config (#3440)
     new 447b2e5dba Merge branch '2.1'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/accumulo/shell/Shell.java |  65 +++++++-----
 .../org/apache/accumulo/shell/ShellOptionsJC.java  |   6 +-
 .../accumulo/test/shell/ShellAuthenticatorIT.java  | 117 +++++++++++++++++++++
 3 files changed, 157 insertions(+), 31 deletions(-)
 create mode 100644 test/src/main/java/org/apache/accumulo/test/shell/ShellAuthenticatorIT.java


[accumulo] 01/01: Merge branch '2.1'

Posted by ct...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 447b2e5dbaf5d59a00433d6bfc6ce8b49fd79f97
Merge: 950306edd0 0f2389735f
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Thu Jun 8 18:04:05 2023 -0400

    Merge branch '2.1'

 .../main/java/org/apache/accumulo/shell/Shell.java |  65 +++++++-----
 .../org/apache/accumulo/shell/ShellOptionsJC.java  |   6 +-
 .../accumulo/test/shell/ShellAuthenticatorIT.java  | 117 +++++++++++++++++++++
 3 files changed, 157 insertions(+), 31 deletions(-)

diff --cc shell/src/main/java/org/apache/accumulo/shell/Shell.java
index a92803cbb3,05dedd2d1b..7e4750a7b4
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@@ -256,6 -258,35 +257,34 @@@ public class Shell extends ShellOption
      this.writer = terminal.writer();
    }
  
 -  // this is visible only for FateCommandTest, otherwise, should be private or inline
 -  protected boolean authenticateUser(AccumuloClient client, AuthenticationToken token)
++  private boolean authenticateUser(AccumuloClient client, AuthenticationToken token)
+       throws AccumuloException, AccumuloSecurityException {
+     return client.securityOperations().authenticateUser(client.whoami(), token);
+   }
+ 
+   private AuthenticationToken getAuthenticationToken(String principal, String authenticationString,
+       String passwordPrompt) {
+     AuthenticationToken token = null;
+     if (authenticationString == null
+         && clientProperties.containsKey(ClientProperty.AUTH_TOKEN.getKey())
+         && principal.equals(ClientProperty.AUTH_PRINCIPAL.getValue(clientProperties))) {
+       token = ClientProperty.getAuthenticationToken(clientProperties);
+     }
+     if (token == null) {
+       // Read password if the user explicitly asked for it, or didn't specify anything at all
+       if (PasswordConverter.STDIN.equals(authenticationString) || authenticationString == null) {
+         authenticationString = reader.readLine(passwordPrompt, '*');
+       }
+       if (authenticationString == null) {
+         // User cancel, e.g. Ctrl-D pressed
+         throw new ParameterException("No password or token option supplied");
+       } else {
+         token = new PasswordToken(authenticationString);
+       }
+     }
+     return token;
+   }
+ 
    /**
     * Configures the shell using the provided options. Not for client use.
     *