本文整理汇总了Java中org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler类的典型用法代码示例。如果您正苦于以下问题:Java KerberosDelegationTokenAuthenticationHandler类的具体用法?Java KerberosDelegationTokenAuthenticationHandler怎么用?Java KerberosDelegationTokenAuthenticationHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KerberosDelegationTokenAuthenticationHandler类属于org.apache.hadoop.security.token.delegation.web包,在下文中一共展示了KerberosDelegationTokenAuthenticationHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler; //导入依赖的package包/类
@Override
protected Properties getConfiguration(String configPrefix,
FilterConfig filterConfig) {
Properties props = new Properties();
Configuration conf = KMSWebApp.getConfiguration();
for (Map.Entry<String, String> entry : conf) {
String name = entry.getKey();
if (name.startsWith(CONFIG_PREFIX)) {
String value = conf.get(name);
name = name.substring(CONFIG_PREFIX.length());
props.setProperty(name, value);
}
}
String authType = props.getProperty(AUTH_TYPE);
if (authType.equals(PseudoAuthenticationHandler.TYPE)) {
props.setProperty(AUTH_TYPE,
PseudoDelegationTokenAuthenticationHandler.class.getName());
} else if (authType.equals(KerberosAuthenticationHandler.TYPE)) {
props.setProperty(AUTH_TYPE,
KerberosDelegationTokenAuthenticationHandler.class.getName());
}
props.setProperty(DelegationTokenAuthenticationHandler.TOKEN_KIND,
KMSClientProvider.TOKEN_KIND);
return props;
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:26,代码来源:KMSAuthenticationFilter.java
示例2: getConfiguration
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler; //导入依赖的package包/类
@Override
protected Properties getConfiguration(String configPrefix,
FilterConfig filterConfig) {
Properties props = new Properties();
Configuration conf = KMSWebApp.getConfiguration();
for (Map.Entry<String, String> entry : conf) {
String name = entry.getKey();
if (name.startsWith(CONFIG_PREFIX)) {
String value = conf.get(name);
name = name.substring(CONFIG_PREFIX.length());
props.setProperty(name, value);
}
}
String authType = props.getProperty(AUTH_TYPE);
if (authType.equals(PseudoAuthenticationHandler.TYPE)) {
props.setProperty(AUTH_TYPE,
PseudoDelegationTokenAuthenticationHandler.class.getName());
} else if (authType.equals(KerberosAuthenticationHandler.TYPE)) {
props.setProperty(AUTH_TYPE,
KerberosDelegationTokenAuthenticationHandler.class.getName());
}
props.setProperty(DelegationTokenAuthenticationHandler.TOKEN_KIND,
KMSDelegationToken.TOKEN_KIND_STR);
return props;
}
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:KMSAuthenticationFilter.java
示例3: getConfiguration
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler; //导入依赖的package包/类
/**
* Returns the hadoop-auth configuration from HttpFSServer's configuration.
* <p>
* It returns all HttpFSServer's configuration properties prefixed with
* <code>httpfs.authentication</code>. The <code>httpfs.authentication</code>
* prefix is removed from the returned property names.
*
* @param configPrefix parameter not used.
* @param filterConfig parameter not used.
*
* @return hadoop-auth configuration read from HttpFSServer's configuration.
*/
@Override
protected Properties getConfiguration(String configPrefix,
FilterConfig filterConfig) throws ServletException{
Properties props = new Properties();
Configuration conf = HttpFSServerWebApp.get().getConfig();
props.setProperty(AuthenticationFilter.COOKIE_PATH, "/");
for (Map.Entry<String, String> entry : conf) {
String name = entry.getKey();
if (name.startsWith(CONF_PREFIX)) {
String value = conf.get(name);
name = name.substring(CONF_PREFIX.length());
props.setProperty(name, value);
}
}
String signatureSecretFile = props.getProperty(SIGNATURE_SECRET_FILE, null);
if (signatureSecretFile == null) {
throw new RuntimeException("Undefined property: " + SIGNATURE_SECRET_FILE);
}
try {
StringBuilder secret = new StringBuilder();
Reader reader = new InputStreamReader(new FileInputStream(
signatureSecretFile), Charsets.UTF_8);
int c = reader.read();
while (c > -1) {
secret.append((char)c);
c = reader.read();
}
reader.close();
props.setProperty(AuthenticationFilter.SIGNATURE_SECRET, secret.toString());
} catch (IOException ex) {
throw new RuntimeException("Could not read HttpFS signature secret file: " + signatureSecretFile);
}
setAuthHandlerClass(props);
props.setProperty(KerberosDelegationTokenAuthenticationHandler.TOKEN_KIND,
WebHdfsConstants.WEBHDFS_TOKEN_KIND.toString());
return props;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:53,代码来源:HttpFSAuthenticationFilter.java
示例4: getConfiguration
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler; //导入依赖的package包/类
@Override
protected Properties getConfiguration(String configPrefix,
FilterConfig filterConfig) throws ServletException {
Properties properties = new Properties();
MapContext mapContext = SqoopConfiguration.getInstance().getContext();
String type = mapContext.getString(
SecurityConstants.AUTHENTICATION_TYPE,
SecurityConstants.TYPE.SIMPLE.name()).trim();
if (type.equalsIgnoreCase(SecurityConstants.TYPE.KERBEROS.name())) {
properties.setProperty(AUTH_TYPE, KerberosDelegationTokenAuthenticationHandler.class.getName());
String keytab = mapContext.getString(
SecurityConstants.AUTHENTICATION_KERBEROS_HTTP_KEYTAB).trim();
if (keytab.length() == 0) {
throw new SqoopException(SecurityError.AUTH_0005,
SecurityConstants.AUTHENTICATION_KERBEROS_HTTP_KEYTAB);
}
String principal = mapContext.getString(
SecurityConstants.AUTHENTICATION_KERBEROS_HTTP_PRINCIPAL).trim();
if (principal.length() == 0) {
throw new SqoopException(SecurityError.AUTH_0006,
SecurityConstants.AUTHENTICATION_KERBEROS_HTTP_PRINCIPAL);
}
String hostPrincipal = "";
try {
hostPrincipal = SecurityUtil.getServerPrincipal(principal, "0.0.0.0");
} catch (IOException e) {
throw new SqoopException(SecurityError.AUTH_0006,
SecurityConstants.AUTHENTICATION_KERBEROS_HTTP_PRINCIPAL);
}
properties.setProperty(KerberosAuthenticationHandler.PRINCIPAL, hostPrincipal);
properties.setProperty(KerberosAuthenticationHandler.KEYTAB, keytab);
} else if (type.equalsIgnoreCase(SecurityConstants.TYPE.SIMPLE.name())) {
properties.setProperty(AUTH_TYPE, PseudoDelegationTokenAuthenticationHandler.class.getName());
properties.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED,
mapContext.getString(SecurityConstants.AUTHENTICATION_ANONYMOUS, "true").trim());
} else {
throw new SqoopException(SecurityError.AUTH_0004, type);
}
properties.setProperty(DelegationTokenAuthenticationHandler.TOKEN_KIND,
SecurityConstants.TOKEN_KIND);
return properties;
}
开发者ID:vybs,项目名称:sqoop-on-spark,代码行数:50,代码来源:SqoopAuthenticationFilter.java
注:本文中的org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论