Examples of AuthenticationToken


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

      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;
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
View Full Code Here

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

    String authsString = props.getProperty("auths", "_random");
   
    String targetUser = props.getProperty("system");
    String target;
    String authPrincipal;
    AuthenticationToken authToken;
    if ("table".equals(targetUser)) {
      target = WalkingSecurity.get(state).getTabUserName();
      authPrincipal = WalkingSecurity.get(state).getSysUserName();
      authToken = WalkingSecurity.get(state).getSysToken();
    } else {
View Full Code Here

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

  public void visit(State state, Properties props) throws Exception {
    String target = props.getProperty("target");
    String source = props.getProperty("source");
   
    String principal;
    AuthenticationToken token;
    if (source.equals("system")) {
      principal = WalkingSecurity.get(state).getSysUserName();
      token = WalkingSecurity.get(state).getSysToken();
    } else {
      principal = WalkingSecurity.get(state).getTabUserName();
View Full Code Here

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

  }
 
  public static void dropTable(State state, Properties props) throws Exception {
    String sourceUser = props.getProperty("source", "system");
    String principal;
    AuthenticationToken token;
    if (sourceUser.equals("table")) {
      principal = WalkingSecurity.get(state).getTabUserName();
      token = WalkingSecurity.get(state).getTabToken();
    } else {
      principal = WalkingSecurity.get(state).getSysUserName();
View Full Code Here

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

      tabPerm = TablePermission.valueOf(perm);
    String tableName = WalkingSecurity.get(state).getTableName();
    boolean hasPerm = WalkingSecurity.get(state).hasTablePermission(target, tableName, tabPerm);
    boolean canGive;
    String sourceUser;
    AuthenticationToken sourceToken;
    if ("system".equals(sourceUserProp)) {
      sourceUser = WalkingSecurity.get(state).getSysUserName();
      sourceToken = WalkingSecurity.get(state).getSysToken();
    } else if ("table".equals(sourceUserProp)) {
      sourceUser = WalkingSecurity.get(state).getTabUserName();
View Full Code Here

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

   */
  public static final Credentials deserialize(String serializedForm) {
    String[] split = serializedForm.split(":", 3);
    String principal = split[0].equals("-") ? null : new String(Base64.decodeBase64(split[0]), Constants.UTF8);
    String tokenType = split[1].equals("-") ? null : new String(Base64.decodeBase64(split[1]), Constants.UTF8);
    AuthenticationToken token = null;
    if (!split[2].equals("-")) {
      byte[] tokenBytes = Base64.decodeBase64(split[2]);
      token = AuthenticationTokenSerializer.deserialize(tokenType, tokenBytes);
    }
    return new Credentials(principal, token);
View Full Code Here

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

      String principal = opts.principal;
      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;
      if (tokenFile == null) {
View Full Code Here

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

  public void changePassword(TCredentials credentials, Credentials toChange) throws ThriftSecurityException {
    if (!canChangePassword(credentials, toChange.getPrincipal()))
      throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
    try {
      AuthenticationToken token = toChange.getToken();
      authenticator.changePassword(toChange.getPrincipal(), token);
      log.info("Changed password for user " + toChange.getPrincipal() + " at the request of user " + credentials.getPrincipal());
    } catch (AccumuloSecurityException e) {
      throw e.asThriftException();
    }
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationToken

        String userName = request.getHeader("Remote-User");
        if (StringUtils.isEmpty(userName)) {
            return super.authenticate(request, response);
        } else {
            return new AuthenticationToken(userName, userName, getType());
        }
    }
View Full Code Here

Examples of org.apache.hadoop.security.authentication.server.AuthenticationToken

   */
  @Override
  public AuthenticationToken authenticate(HttpServletRequest request,
      HttpServletResponse response) throws IOException, AuthenticationException {

    AuthenticationToken token;
    String delegationParam = this.getEncodedDelegationTokenFromRequest(request);
    if (delegationParam != null) {
      Token<RMDelegationTokenIdentifier> dt =
          new Token<RMDelegationTokenIdentifier>();
      ;
      dt.decodeFromUrlString(delegationParam);
      UserGroupInformation ugi = this.verifyToken(dt);
      if (ugi == null) {
        throw new AuthenticationException("Invalid token");
      }
      final String shortName = ugi.getShortUserName();
      token = new AuthenticationToken(shortName, ugi.getUserName(), getType());
    } else {
      token = super.authenticate(request, response);
      if (token != null) {
        // create a token with auth type set correctly
        token =
            new AuthenticationToken(token.getUserName(), token.getName(),
              super.getType());
      }
    }
    return token;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.