当前位置: 首页>>代码示例>>Java>>正文


Java KerberosUtil类代码示例

本文整理汇总了Java中org.apache.hadoop.security.authentication.util.KerberosUtil的典型用法代码示例。如果您正苦于以下问题:Java KerberosUtil类的具体用法?Java KerberosUtil怎么用?Java KerberosUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KerberosUtil类属于org.apache.hadoop.security.authentication.util包,在下文中一共展示了KerberosUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConfiguration

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
/**
 * Set the static configuration to get the rules.
 * <p/>
 * IMPORTANT: This method does a NOP if the rules have been set already.
 * If there is a need to reset the rules, the {@link KerberosName#setRules(String)}
 * method should be invoked directly.
 * 
 * @param conf the new configuration
 * @throws IOException
 */
public static void setConfiguration(Configuration conf) throws IOException {
  final String defaultRule;
  switch (SecurityUtil.getAuthenticationMethod(conf)) {
    case KERBEROS:
    case KERBEROS_SSL:
      try {
        KerberosUtil.getDefaultRealm();
      } catch (Exception ke) {
        throw new IllegalArgumentException("Can't get Kerberos realm", ke);
      }
      defaultRule = "DEFAULT";
      break;
    default:
      // just extract the simple user name
      defaultRule = "RULE:[1:$1] RULE:[2:$1]";
      break; 
  }
  String ruleString = conf.get(HADOOP_SECURITY_AUTH_TO_LOCAL, defaultRule);
  setRules(ruleString);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:31,代码来源:HadoopKerberosName.java

示例2: getAppConfigurationEntry

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
  Map<String, String> options = new HashMap<String, String>();
  options.put("principal", principal);
  options.put("keyTab", keytab);
  options.put("useKeyTab", "true");
  options.put("storeKey", "true");
  options.put("doNotPrompt", "true");
  options.put("useTicketCache", "true");
  options.put("renewTGT", "true");
  options.put("refreshKrb5Config", "true");
  options.put("isInitiator", "true");
  String ticketCache = System.getenv("KRB5CCNAME");
  if (ticketCache != null) {
    options.put("ticketCache", ticketCache);
  }
  options.put("debug", "true");

  return new AppConfigurationEntry[]{
      new AppConfigurationEntry(KerberosUtil.getKrb5LoginModuleName(),
          AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
          options),};
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestWebDelegationToken.java

示例3: getAppConfigurationEntry

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
  Map<String, String> options = new HashMap<String, String>();
  options.put("keyTab", keytab);
  options.put("principal", principal);
  options.put("useKeyTab", "true");
  options.put("storeKey", "true");
  options.put("doNotPrompt", "true");
  options.put("useTicketCache", "true");
  options.put("renewTGT", "true");
  options.put("refreshKrb5Config", "true");
  options.put("isInitiator", Boolean.toString(isInitiator));
  String ticketCache = System.getenv("KRB5CCNAME");
  if (ticketCache != null) {
    options.put("ticketCache", ticketCache);
  }
  options.put("debug", "true");

  return new AppConfigurationEntry[]{
      new AppConfigurationEntry(KerberosUtil.getKrb5LoginModuleName(),
          AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
          options)
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:KerberosConfiguration.java

示例4: getAppConfigurationEntry

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
  Map<String, String> options = new HashMap<String, String>();
  options.put("keyTab", KerberosTestUtils.getKeytabFile());
  options.put("principal", principal);
  options.put("useKeyTab", "true");
  options.put("storeKey", "true");
  options.put("doNotPrompt", "true");
  options.put("useTicketCache", "true");
  options.put("renewTGT", "true");
  options.put("refreshKrb5Config", "true");
  options.put("isInitiator", "true");
  String ticketCache = System.getenv("KRB5CCNAME");
  if (ticketCache != null) {
    options.put("ticketCache", ticketCache);
  }
  options.put("debug", "true");

  return new AppConfigurationEntry[]{
    new AppConfigurationEntry(KerberosUtil.getKrb5LoginModuleName(),
                              AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
                              options),};
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:KerberosTestUtils.java

示例5: getAppConfigurationEntry

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
  Map<String, String> options = new HashMap<String, String>();
  options.put("keyTab", keytab);
  options.put("principal", principal);
  options.put("useKeyTab", "true");
  options.put("storeKey", "true");
  options.put("doNotPrompt", "true");
  options.put("useTicketCache", "true");
  options.put("renewTGT", "true");
  options.put("refreshKrb5Config", "true");
  options.put("isInitiator", "false");
  String ticketCache = System.getenv("KRB5CCNAME");
  if (ticketCache != null) {
    options.put("ticketCache", ticketCache);
  }
  if (LOG.isDebugEnabled()) {
    options.put("debug", "true");
  }

  return new AppConfigurationEntry[]{
      new AppConfigurationEntry(KerberosUtil.getKrb5LoginModuleName(),
                              AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
                              options),};
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:KerberosAuthenticationHandler.java

示例6: getAppConfigurationEntry

import org.apache.hadoop.security.authentication.util.KerberosUtil; //导入依赖的package包/类
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
  Map<String, String> options = new HashMap<>();
  options.put("keyTab", KerberosTestUtils.getKeytabFile());
  options.put("principal", principal);
  options.put("useKeyTab", "true");
  options.put("storeKey", "true");
  options.put("doNotPrompt", "true");
  options.put("useTicketCache", "true");
  options.put("renewTGT", "true");
  options.put("refreshKrb5Config", "true");
  options.put("isInitiator", "true");
  String ticketCache = System.getenv("KRB5CCNAME");
  if (ticketCache != null) {
    options.put("ticketCache", ticketCache);
  }
  options.put("debug", "true");

  return new AppConfigurationEntry[]{
      new AppConfigurationEntry(KerberosUtil.getKrb5LoginModuleName(),
          AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options),};
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:KerberosTestUtils.java


注:本文中的org.apache.hadoop.security.authentication.util.KerberosUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。