本文整理汇总了Java中org.apache.accumulo.core.security.thrift.TCredentials类的典型用法代码示例。如果您正苦于以下问题:Java TCredentials类的具体用法?Java TCredentials怎么用?Java TCredentials使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TCredentials类属于org.apache.accumulo.core.security.thrift包,在下文中一共展示了TCredentials类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeSecurity
import org.apache.accumulo.core.security.thrift.TCredentials; //导入依赖的package包/类
@Override
public void initializeSecurity(TCredentials credentials, String principal,
byte[] token) throws AccumuloSecurityException {
String pass = null;
SiteConfiguration siteconf = SiteConfiguration.getInstance(
DefaultConfiguration.getInstance());
String jksFile = siteconf.get(
Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS);
if (jksFile == null) {
throw new RuntimeException(
Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS +
" not specified in accumulo-site.xml");
}
try {
pass = new String(ProviderUtil.getPassword(jksFile,
ROOT_INITIAL_PASSWORD_PROPERTY));
} catch (IOException ioe) {
throw new RuntimeException("Can't get key " +
ROOT_INITIAL_PASSWORD_PROPERTY + " from " + jksFile, ioe);
}
zkAuthenticator.initializeSecurity(credentials, principal,
pass.getBytes(Charset.forName("UTF-8")));
}