Java 类org.apache.hadoop.security.token.TokenSelector 实例源码

项目:hadoop-oss    文件:SaslRpcClient.java   
/**
 * Try to locate the required token for the server.
 * 
 * @param authType of the SASL client
 * @return Token for server, or null if no token available
 * @throws IOException - token selector cannot be instantiated
 */
private Token<?> getServerToken(SaslAuth authType) throws IOException {
  TokenInfo tokenInfo = SecurityUtil.getTokenInfo(protocol, conf);
  LOG.debug("Get token info proto:" + protocol + " info:" + tokenInfo);
  if (tokenInfo == null) { // protocol has no support for tokens
    return null;
  }
  TokenSelector<?> tokenSelector = null;
  try {
    tokenSelector = tokenInfo.value().newInstance();
  } catch (InstantiationException | IllegalAccessException e) {
    throw new IOException(e.toString(), e);
  }
  return tokenSelector.selectToken(
      SecurityUtil.buildTokenService(serverAddr), ugi.getTokens());
}
项目:hadoop    文件:ContainerManagerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ContainerManagementProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return NMTokenSelector.class;
    }
  };

}
项目:hadoop    文件:SchedulerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(ApplicationMasterProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return AMRMTokenSelector.class;
    }
  };
}
项目:hadoop    文件:ClientRMSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return RMDelegationTokenSelector.class;
    }
  };
}
项目:hadoop    文件:ClientTimelineSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationHistoryProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return TimelineDelegationTokenSelector.class;
    }
  };
}
项目:hadoop    文件:LocalizerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(LocalizationProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      LOG.debug("Using localizerTokenSecurityInfo");
      return LocalizerTokenSelector.class;
    }
  };
}
项目:hadoop    文件:TestClientToAMTokens.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:hadoop    文件:MRClientSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(MRClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:hadoop    文件:ClientHSSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(HSClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientHSTokenSelector.class;
    }
  };  }
项目:aliyun-oss-hadoop-fs    文件:ContainerManagerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ContainerManagementProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return NMTokenSelector.class;
    }
  };

}
项目:aliyun-oss-hadoop-fs    文件:SchedulerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(ApplicationMasterProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return AMRMTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:ClientRMSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return RMDelegationTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:ClientTimelineSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationHistoryProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return TimelineDelegationTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:LocalizerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(LocalizationProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      LOG.debug("Using localizerTokenSecurityInfo");
      return LocalizerTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:TestClientToAMTokens.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:MRClientSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(MRClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:aliyun-oss-hadoop-fs    文件:ClientHSSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(HSClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientHSTokenSelector.class;
    }
  };  }
项目:aliyun-oss-hadoop-fs    文件:SaslRpcClient.java   
/**
 * Try to locate the required token for the server.
 * 
 * @param authType of the SASL client
 * @return Token for server, or null if no token available
 * @throws IOException - token selector cannot be instantiated
 */
private Token<?> getServerToken(SaslAuth authType) throws IOException {
  TokenInfo tokenInfo = SecurityUtil.getTokenInfo(protocol, conf);
  LOG.debug("Get token info proto:" + protocol + " info:" + tokenInfo);
  if (tokenInfo == null) { // protocol has no support for tokens
    return null;
  }
  TokenSelector<?> tokenSelector = null;
  try {
    tokenSelector = tokenInfo.value().newInstance();
  } catch (InstantiationException | IllegalAccessException e) {
    throw new IOException(e.toString(), e);
  }
  return tokenSelector.selectToken(
      SecurityUtil.buildTokenService(serverAddr), ugi.getTokens());
}
项目:big-c    文件:ContainerManagerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ContainerManagementProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return NMTokenSelector.class;
    }
  };

}
项目:big-c    文件:SchedulerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(ApplicationMasterProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return AMRMTokenSelector.class;
    }
  };
}
项目:big-c    文件:ClientRMSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return RMDelegationTokenSelector.class;
    }
  };
}
项目:big-c    文件:ClientTimelineSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationHistoryProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return TimelineDelegationTokenSelector.class;
    }
  };
}
项目:big-c    文件:LocalizerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(LocalizationProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      LOG.debug("Using localizerTokenSecurityInfo");
      return LocalizerTokenSelector.class;
    }
  };
}
项目:big-c    文件:TestClientToAMTokens.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:big-c    文件:MRClientSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(MRClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:big-c    文件:ClientHSSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(HSClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientHSTokenSelector.class;
    }
  };  }
项目:hadoop-2.6.0-cdh5.4.3    文件:ContainerManagerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ContainerManagementProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return NMTokenSelector.class;
    }
  };

}
项目:hadoop-2.6.0-cdh5.4.3    文件:SchedulerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(ApplicationMasterProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return AMRMTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientRMSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return RMDelegationTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientTimelineSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationHistoryProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return TimelineDelegationTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:LocalizerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(LocalizationProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      LOG.debug("Using localizerTokenSecurityInfo");
      return LocalizerTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientToAMTokens.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:MRClientSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(MRClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientHSSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(HSClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientHSTokenSelector.class;
    }
  };  }
项目:hadoop-plus    文件:ContainerManagerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ContainerManagementProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return NMTokenSelector.class;
    }
  };

}
项目:hadoop-plus    文件:SchedulerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(ApplicationMasterProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return AMRMTokenSelector.class;
    }
  };
}
项目:hadoop-plus    文件:ClientRMSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(ApplicationClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return RMDelegationTokenSelector.class;
    }
  };
}
项目:hadoop-plus    文件:LocalizerSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol
      .equals(LocalizationProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      LOG.debug("Using localizerTokenSecurityInfo");
      return LocalizerTokenSelector.class;
    }
  };
}
项目:hadoop-plus    文件:TestClientToAMTokens.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}
项目:hadoop-plus    文件:MRClientSecurityInfo.java   
@Override
public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
  if (!protocol.equals(MRClientProtocolPB.class)) {
    return null;
  }
  return new TokenInfo() {

    @Override
    public Class<? extends Annotation> annotationType() {
      return null;
    }

    @Override
    public Class<? extends TokenSelector<? extends TokenIdentifier>>
        value() {
      return ClientToAMTokenSelector.class;
    }
  };
}