Example usage for javax.security.sasl Sasl POLICY_NOPLAINTEXT

List of usage examples for javax.security.sasl Sasl POLICY_NOPLAINTEXT

Introduction

In this page you can find the example usage for javax.security.sasl Sasl POLICY_NOPLAINTEXT.

Prototype

String POLICY_NOPLAINTEXT

To view the source code for javax.security.sasl Sasl POLICY_NOPLAINTEXT.

Click Source Link

Document

The name of a property that specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted.

Usage

From source file:backtype.storm.messaging.netty.SaslUtils.java

static Map<String, String> getSaslProps() {
    Map<String, String> props = new HashMap<String, String>();
    props.put(Sasl.POLICY_NOPLAINTEXT, "true");
    return props;
}

From source file:org.apache.hive.spark.client.rpc.RpcConfiguration.java

/**
 * SASL options are namespaced under "hive.spark.client.rpc.sasl.*"; each option is the
 * lower-case version of the constant in the "javax.security.sasl.Sasl" class (e.g. "strength"
 * for cipher strength).//  ww w  . ja  va 2  s  .  c o m
 */
Map<String, String> getSaslOptions() {
    Map<String, String> opts = new HashMap<String, String>();
    Map<String, String> saslOpts = ImmutableMap.<String, String>builder().put(Sasl.CREDENTIALS, "credentials")
            .put(Sasl.MAX_BUFFER, "max_buffer").put(Sasl.POLICY_FORWARD_SECRECY, "policy_forward_secrecy")
            .put(Sasl.POLICY_NOACTIVE, "policy_noactive").put(Sasl.POLICY_NOANONYMOUS, "policy_noanonymous")
            .put(Sasl.POLICY_NODICTIONARY, "policy_nodictionary")
            .put(Sasl.POLICY_NOPLAINTEXT, "policy_noplaintext")
            .put(Sasl.POLICY_PASS_CREDENTIALS, "policy_pass_credentials").put(Sasl.QOP, "qop")
            .put(Sasl.RAW_SEND_SIZE, "raw_send_size").put(Sasl.REUSE, "reuse")
            .put(Sasl.SERVER_AUTH, "server_auth").put(Sasl.STRENGTH, "strength").build();
    for (Map.Entry<String, String> e : saslOpts.entrySet()) {
        String value = config.get(RPC_SASL_OPT_PREFIX + e.getValue());
        if (value != null) {
            opts.put(e.getKey(), value);
        }
    }
    return opts;
}

From source file:org.apache.storm.messaging.netty.SaslUtils.java

static Map<String, String> getSaslProps() {
    Map<String, String> props = new HashMap<>();
    props.put(Sasl.POLICY_NOPLAINTEXT, "true");
    return props;
}

From source file:org.wildfly.test.integration.elytron.sasl.mgmt.ExternalMgmtSaslTestCase.java

/**
 * Tests SASL mechanism filtering through policy properties which are matched by EXTERNAL mechanism.
 *
 * @see <a href="https://issues.jboss.org/browse/ELY-982">ELY-982</a>
 *//*from   w  w w.  ja v  a  2 s.c  o  m*/
@Test
public void testMatchingFilteringProperties() throws Exception {
    Map<String, String> mechanismProperties = new HashMap<>();
    mechanismProperties.put(Sasl.POLICY_NOPLAINTEXT, "true");
    mechanismProperties.put(Sasl.POLICY_NOACTIVE, "true");
    mechanismProperties.put(Sasl.POLICY_NODICTIONARY, "true");
    AuthenticationConfiguration authCfg = AuthenticationConfiguration.empty()
            .setSaslMechanismSelector(SaslMechanismSelector.fromString(MECHANISM))
            .useMechanismProperties(mechanismProperties);

    SecurityFactory<SSLContext> ssl = new SSLContextBuilder().setClientMode(true)
            .setKeyManager(getKeyManager(CLIENT_KEYSTORE_FILE)).setTrustManager(getTrustManager()).build();
    AuthenticationContext.empty().with(MatchRule.ALL, authCfg).withSsl(MatchRule.ALL, ssl)
            .run(() -> assertWhoAmI("client"));
}