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

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

commit 62cd737399b4a0a8a0bcef6eef6180b3ec3df48c
Merge: 3c5bb40ae9 f54a2b214a
Author: Christopher Tubbs <ctubb...@apache.org>
AuthorDate: Wed Jul 24 09:18:39 2024 -0400

    Merge branch '2.1'

 .../security/tokens/CredentialProviderToken.java   |  26 ++++++++-
 .../core/client/security/tokens/PasswordToken.java |   1 +
 .../accumulo/core/conf/AccumuloConfiguration.java  |   4 +-
 .../org/apache/accumulo/core/conf/Property.java    |   6 +-
 .../org/apache/accumulo/core/util/CreateToken.java |   2 +-
 .../tokens/CredentialProviderTokenTest.java        |  65 ++++++++++++++++-----
 core/src/test/resources/passwords.jceks            | Bin 963 -> 967 bytes
 .../server/conf/RuntimeFixedProperties.java        |  13 +++++
 .../accumulo/server/conf/SystemConfiguration.java  |   5 +-
 .../AccumuloConfigurationIsPropertySetTest.java    |  28 +++++++--
 .../server/conf/SystemConfigurationTest.java       |   5 +-
 .../org/apache/accumulo/tserver/ScanServer.java    |   2 +-
 .../accumulo/test/ScanServerMetadataEntriesIT.java |   2 +-
 13 files changed, 130 insertions(+), 29 deletions(-)

diff --cc core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
index cccd00f263,f17cf675d6..80cfa9dec9
--- a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
@@@ -86,35 -86,34 +86,35 @@@ public class CreateToken implements Key
        pass = opts.securePassword;
      }
  
 -    try {
 -      String principal = opts.principal;
 -      if (principal == null) {
 -        principal = getConsoleReader().readLine("Username (aka principal): ");
 -      }
 +    String principal = opts.principal;
 +    if (principal == null) {
 +      principal = getConsoleReader().readLine("Username (aka principal): ");
 +    }
  
 -      AuthenticationToken token = Class.forName(opts.tokenClassName)
 -          
.asSubclass(AuthenticationToken.class).getDeclaredConstructor().newInstance();
 -      Properties props = new Properties();
 -      for (TokenProperty tp : token.getProperties()) {
 -        String input;
 -        if (pass != null && tp.getKey().equals("password")) {
 -          input = pass;
 +    AuthenticationToken token;
 +    try {
 +      token = 
Class.forName(opts.tokenClassName).asSubclass(AuthenticationToken.class)
 +          .getDeclaredConstructor().newInstance();
 +    } catch (ReflectiveOperationException e) {
 +      throw new IllegalStateException(e);
 +    }
 +    Properties props = new Properties();
 +    for (TokenProperty tp : token.getProperties()) {
 +      String input;
 +      if (pass != null && tp.getKey().equals("password")) {
 +        input = pass;
 +      } else {
 +        if (tp.getMask()) {
 +          input = getConsoleReader().readLine(tp.getDescription() + ": ", 
'*');
          } else {
 -          if (tp.getMask()) {
 -            input = getConsoleReader().readLine(tp.getDescription() + ": ", 
'*');
 -          } else {
 -            input = getConsoleReader().readLine(tp.getDescription() + ": ");
 -          }
 +          input = getConsoleReader().readLine(tp.getDescription() + ": ");
          }
 -        props.put(tp.getKey(), input);
        }
 -      token.init(props);
 -      System.out.println("auth.type = " + opts.tokenClassName);
 -      System.out.println("auth.principal = " + principal);
 -      System.out.println("auth.token = " + ClientProperty.encodeToken(token));
 -    } catch (ReflectiveOperationException e) {
 -      throw new RuntimeException(e);
 +      props.put(tp.getKey(), input);
-       token.init(props);
      }
++    token.init(props);
 +    System.out.println("auth.type = " + opts.tokenClassName);
 +    System.out.println("auth.principal = " + principal);
 +    System.out.println("auth.token = " + ClientProperty.encodeToken(token));
    }
  }

Reply via email to