org.apache.hadoop.security.SaslRpcServer.QualityOfProtection Java Examples

The following examples show how to use org.apache.hadoop.security.SaslRpcServer.QualityOfProtection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSaslRPC.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: TestSaslRPC.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: DataTransferSaslUtil.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: WhitelistBasedResolver.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: SaslPropertiesResolver.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example #6
Source File: TestSaslRPC.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public TestSaslRPC(QualityOfProtection[] qop,
    QualityOfProtection expectedQop,
    String saslPropertiesResolver) {
  this.qop=qop;
  this.expectedQop = expectedQop;
  this.saslPropertiesResolver = saslPropertiesResolver;
}
 
Example #7
Source File: TestSaslRPC.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #8
Source File: DataTransferSaslUtil.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #9
Source File: WhitelistBasedResolver.java    From big-c with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: SaslPropertiesResolver.java    From big-c with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example #11
Source File: TestSaslRPC.java    From big-c with Apache License 2.0 5 votes vote down vote up
public TestSaslRPC(QualityOfProtection[] qop,
    QualityOfProtection expectedQop,
    String saslPropertiesResolver) {
  this.qop=qop;
  this.expectedQop = expectedQop;
  this.saslPropertiesResolver = saslPropertiesResolver;
}
 
Example #12
Source File: TestSaslRPC.java    From big-c with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #13
Source File: FanOutOneBlockAsyncDFSOutputSaslHelper.java    From hbase with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: TestSaslRPC.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public Map<String, String> getServerProperties(InetAddress address) {
  Map<String, String> newPropertes = new HashMap<String, String>(getDefaultProperties());
  newPropertes.put(Sasl.QOP, QualityOfProtection.AUTHENTICATION.getSaslQop());
  return newPropertes;
}
 
Example #15
Source File: TestSaslRPC.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public Map<String, String> getServerProperties(InetAddress address) {
  Map<String, String> newPropertes = new HashMap<String, String>(getDefaultProperties());
  newPropertes.put(Sasl.QOP, QualityOfProtection.AUTHENTICATION.getSaslQop());
  return newPropertes;
}