本文整理汇总了Java中org.apache.hadoop.security.SaslRpcServer.QualityOfProtection类的典型用法代码示例。如果您正苦于以下问题:Java QualityOfProtection类的具体用法?Java QualityOfProtection怎么用?Java QualityOfProtection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QualityOfProtection类属于org.apache.hadoop.security.SaslRpcServer包,在下文中一共展示了QualityOfProtection类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: data
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> data() {
Collection<Object[]> params = new ArrayList<Object[]>();
for (QualityOfProtection qop : QualityOfProtection.values()) {
params.add(new Object[]{ new QualityOfProtection[]{qop},qop, null });
}
params.add(new Object[]{ new QualityOfProtection[]{
QualityOfProtection.PRIVACY,QualityOfProtection.AUTHENTICATION },
QualityOfProtection.PRIVACY, null});
params.add(new Object[]{ new QualityOfProtection[]{
QualityOfProtection.PRIVACY,QualityOfProtection.AUTHENTICATION },
QualityOfProtection.AUTHENTICATION ,
"org.apache.hadoop.ipc.TestSaslRPC$AuthSaslPropertiesResolver" });
return params;
}
示例2: getSaslProperties
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
static Map<String, String> getSaslProperties(Configuration conf) {
Map<String, String> saslProps =new TreeMap<String, String>();
String[] qop = conf.getStrings(HADOOP_RPC_PROTECTION_NON_WHITELIST,
QualityOfProtection.PRIVACY.toString());
for (int i=0; i < qop.length; i++) {
qop[i] = QualityOfProtection.valueOf(
StringUtils.toUpperCase(qop[i])).getSaslQop();
}
saslProps.put(Sasl.QOP, StringUtils.join(",", qop));
saslProps.put(Sasl.SERVER_AUTH, "true");
return saslProps;
}
示例3: setConf
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
this.conf = conf;
properties = new TreeMap<String,String>();
String[] qop = conf.getTrimmedStrings(
CommonConfigurationKeysPublic.HADOOP_RPC_PROTECTION,
QualityOfProtection.AUTHENTICATION.toString());
for (int i=0; i < qop.length; i++) {
qop[i] = QualityOfProtection.valueOf(
StringUtils.toUpperCase(qop[i])).getSaslQop();
}
properties.put(Sasl.QOP, StringUtils.join(",", qop));
properties.put(Sasl.SERVER_AUTH, "true");
}
示例4: TestSaslRPC
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
public TestSaslRPC(QualityOfProtection[] qop,
QualityOfProtection expectedQop,
String saslPropertiesResolver) {
this.qop=qop;
this.expectedQop = expectedQop;
this.saslPropertiesResolver = saslPropertiesResolver;
}
示例5: getQOPNames
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
static String getQOPNames (QualityOfProtection[] qops){
StringBuilder sb = new StringBuilder();
int i = 0;
for (QualityOfProtection qop:qops){
sb.append(org.apache.hadoop.util.StringUtils.toLowerCase(qop.name()));
if (++i < qops.length){
sb.append(",");
}
}
return sb.toString();
}
示例6: createSaslPropertiesForEncryption
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
/**
* Creates SASL properties required for an encrypted SASL negotiation.
*
* @param encryptionAlgorithm to use for SASL negotation
* @return properties of encrypted SASL negotiation
*/
public static Map<String, String> createSaslPropertiesForEncryption(
String encryptionAlgorithm) {
Map<String, String> saslProps = Maps.newHashMapWithExpectedSize(3);
saslProps.put(Sasl.QOP, QualityOfProtection.PRIVACY.getSaslQop());
saslProps.put(Sasl.SERVER_AUTH, "true");
saslProps.put("com.sun.security.sasl.digest.cipher", encryptionAlgorithm);
return saslProps;
}
示例7: getSaslProperties
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
static Map<String, String> getSaslProperties(Configuration conf) {
Map<String, String> saslProps =new TreeMap<String, String>();
String[] qop = conf.getStrings(HADOOP_RPC_PROTECTION_NON_WHITELIST,
QualityOfProtection.PRIVACY.toString());
for (int i=0; i < qop.length; i++) {
qop[i] = QualityOfProtection.valueOf(qop[i].toUpperCase()).getSaslQop();
}
saslProps.put(Sasl.QOP, StringUtils.join(",", qop));
saslProps.put(Sasl.SERVER_AUTH, "true");
return saslProps;
}
示例8: setConf
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
this.conf = conf;
properties = new TreeMap<String,String>();
String[] qop = conf.getTrimmedStrings(
CommonConfigurationKeysPublic.HADOOP_RPC_PROTECTION,
QualityOfProtection.AUTHENTICATION.toString());
for (int i=0; i < qop.length; i++) {
qop[i] = QualityOfProtection.valueOf(qop[i].toUpperCase()).getSaslQop();
}
properties.put(Sasl.QOP, StringUtils.join(",", qop));
properties.put(Sasl.SERVER_AUTH, "true");
}
示例9: getQOPNames
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
static String getQOPNames (QualityOfProtection[] qops){
StringBuilder sb = new StringBuilder();
int i = 0;
for (QualityOfProtection qop:qops){
sb.append(qop.name().toLowerCase());
if (++i < qops.length){
sb.append(",");
}
}
return sb.toString();
}
示例10: data
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> data() {
Collection<Object[]> params = new ArrayList<Object[]>();
for (QualityOfProtection qop : QualityOfProtection.values()) {
params.add(new Object[]{ qop });
}
return params;
}
示例11: doDigestRpc
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
private void doDigestRpc(Server server, TestTokenSecretManager sm)
throws Exception {
final UserGroupInformation current = UserGroupInformation.getCurrentUser();
addr = NetUtils.getConnectAddress(server);
TestTokenIdentifier tokenId = new TestTokenIdentifier(new Text(current
.getUserName()));
Token<TestTokenIdentifier> token = new Token<TestTokenIdentifier>(tokenId, sm);
SecurityUtil.setTokenService(token, addr);
current.addToken(token);
TestRpcService proxy = null;
try {
proxy = getClient(addr, conf);
AuthMethod authMethod = convert(
proxy.getAuthMethod(null, newEmptyRequest()));
assertEquals(TOKEN, authMethod);
//QOP must be auth
assertEquals(expectedQop.saslQop,
RPC.getConnectionIdForProxy(proxy).getSaslQop());
int n = 0;
for (Connection connection : server.getConnections()) {
// only qop auth should dispose of the sasl server
boolean hasServer = (connection.saslServer != null);
assertTrue("qop:" + expectedQop + " hasServer:" + hasServer,
(expectedQop == QualityOfProtection.AUTHENTICATION) ^ hasServer);
n++;
}
assertTrue(n > 0);
proxy.ping(null, newEmptyRequest());
} finally {
stop(server, proxy);
}
}
示例12: createSaslPropertiesForEncryption
import org.apache.hadoop.security.SaslRpcServer.QualityOfProtection; //导入依赖的package包/类
private static Map<String, String> createSaslPropertiesForEncryption(String encryptionAlgorithm) {
Map<String, String> saslProps = Maps.newHashMapWithExpectedSize(3);
saslProps.put(Sasl.QOP, QualityOfProtection.PRIVACY.getSaslQop());
saslProps.put(Sasl.SERVER_AUTH, "true");
saslProps.put("com.sun.security.sasl.digest.cipher", encryptionAlgorithm);
return saslProps;
}