Package org.apache.accumulo.core.client.security.tokens.AuthenticationToken

Examples of org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties


    Map<String,String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_TOKEN_PROPERTY_PREFIX);
    if (loginMap.isEmpty()) {
      Property p = Property.TRACE_PASSWORD;
      at = new PasswordToken(conf.get(p).getBytes(Constants.UTF8));
    } else {
      Properties props = new Properties();
      int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length() + 1;
      for (Entry<String,String> entry : loginMap.entrySet()) {
        props.put(entry.getKey().substring(prefixLength), entry.getValue());
      }
     
      AuthenticationToken token;
      try {
        token = AccumuloClassLoader.getClassLoader().loadClass(conf.get(Property.TRACE_TOKEN_TYPE)).asSubclass(AuthenticationToken.class).newInstance();
View Full Code Here


     
      if (user == null)
        throw new MissingArgumentException(usernameOption);
     
      if (loginOptions != null && cl.hasOption(tokenOption.getOpt())) {
        Properties props = new Properties();
        for (String loginOption : loginOptions)
          for (String lo : loginOption.split(",")) {
            String[] split = lo.split("=");
            props.put(split[0], split[1]);
          }
       
        this.token = Class.forName(cl.getOptionValue(tokenOption.getOpt())).asSubclass(AuthenticationToken.class).newInstance();
        this.token.init(props);
      }
View Full Code Here

  public Map<String,String> loginProps = new LinkedHashMap<String,String>();
 

  public AuthenticationToken getToken() {
    if (!loginProps.isEmpty()) {
      Properties props = new Properties();
      for (Entry<String,String> loginOption : loginProps.entrySet())
        props.put(loginOption.getKey(), loginOption.getValue());
     
      try {
        AuthenticationToken token = Class.forName(tokenClassName).asSubclass(AuthenticationToken.class).newInstance();
        token.init(props);
        return token;
View Full Code Here

        Map<String,String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_TOKEN_PROPERTY_PREFIX);
        if (loginMap.isEmpty()) {
          Property p = Property.TRACE_PASSWORD;
          at = new PasswordToken(conf.get(p).getBytes(Constants.UTF8));
        } else {
          Properties props = new Properties();
          AuthenticationToken token = AccumuloClassLoader.getClassLoader().loadClass(conf.get(Property.TRACE_TOKEN_TYPE)).asSubclass(AuthenticationToken.class)
              .newInstance();

          int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length() + 1;
          for (Entry<String,String> entry : loginMap.entrySet()) {
            props.put(entry.getKey().substring(prefixLength), entry.getValue());
          }

          token.init(props);
         
          at = token;
View Full Code Here

        Map<String,String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_TOKEN_PROPERTY_PREFIX);
        if (loginMap.isEmpty()) {
          Property p = Property.TRACE_PASSWORD;
          at = new PasswordToken(conf.get(p).getBytes());
        } else {
          Properties props = new Properties();
          AuthenticationToken token = AccumuloClassLoader.getClassLoader().loadClass(conf.get(Property.TRACE_TOKEN_TYPE)).asSubclass(AuthenticationToken.class)
              .newInstance();

          int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length() + 1;
          for (Entry<String,String> entry : loginMap.entrySet()) {
            props.put(entry.getKey().substring(prefixLength), entry.getValue());
          }

          token.init(props);
         
          at = token;
View Full Code Here

  public Map<String,String> loginProps = new LinkedHashMap<String,String>();
 

  public AuthenticationToken getToken() {
    if (!loginProps.isEmpty()) {
      Properties props = new Properties();
      for (Entry<String,String> loginOption : loginProps.entrySet())
        props.put(loginOption.getKey(), loginOption.getValue());
     
      try {
        AuthenticationToken token = Class.forName(tokenClassName).asSubclass(AuthenticationToken.class).newInstance();
        token.init(props);
        return token;
View Full Code Here

      if (principal == null) {
        principal = getConsoleReader().readLine("Username (aka principal): ");
      }
     
      AuthenticationToken token = Class.forName(opts.tokenClassName).asSubclass(AuthenticationToken.class).newInstance();
      Properties props = new Properties();
      for (TokenProperty tp : token.getProperties()) {
        String input;
        if (pass != null && tp.getKey().equals("password")) {
          input = pass.toString();
        } else {
          if (tp.getMask()) {
            input = getConsoleReader().readLine(tp.getDescription() + ": ", '*');
          } else {
            input = getConsoleReader().readLine(tp.getDescription() + ": ");
          }
        }
        props.put(tp.getKey(), input);
        token.init(props);
      }
      String tokenBase64 = Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token));
     
      String tokenFile = opts.tokenFile;
View Full Code Here

    }

    CredentialProviderToken token = new CredentialProviderToken("root.password", keystorePath);

    CredentialProviderToken uninitializedToken = new CredentialProviderToken();
    Properties props = new Properties();
    props.put(CredentialProviderToken.NAME_PROPERTY, "root.password");
    props.put(CredentialProviderToken.CREDENTIAL_PROVIDERS_PROPERTY, keystorePath);
    uninitializedToken.init(props);

    Assert.assertArrayEquals(token.getPassword(), uninitializedToken.getPassword());
  }
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void missingProperties() throws Exception {
    CredentialProviderToken token = new CredentialProviderToken();
    token.init(new Properties());
  }
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void missingNameProperty() throws Exception {
    CredentialProviderToken token = new CredentialProviderToken();
    Properties props = new Properties();
    props.put(CredentialProviderToken.NAME_PROPERTY, "root.password");
    token.init(props);
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.