Example usage for javax.security.sasl SaslServerFactory getMechanismNames

List of usage examples for javax.security.sasl SaslServerFactory getMechanismNames

Introduction

In this page you can find the example usage for javax.security.sasl SaslServerFactory getMechanismNames.

Prototype

public abstract String[] getMechanismNames(Map<String, ?> props);

Source Link

Document

Returns an array of names of mechanisms that match the specified mechanism selection policies.

Usage

From source file:org.wildfly.security.sasl.entity.EntityTest.java

@Test
public void testServerAuthDirect_Server() {
    SaslServerFactory factory = obtainSaslServerFactory(EntitySaslServerFactory.class);
    assertNotNull("SaslServerFactory not registered", factory);

    String[] mechanisms;/*ww  w .  j  a v a  2s  .c  o m*/
    Map<String, Object> props = new HashMap<String, Object>();

    // No properties set
    mechanisms = factory.getMechanismNames(props);
    assertMechanisms(new String[] { SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
            SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC,
            SaslMechanismInformation.Names.IEC_ISO_9798_U_DSA_SHA1,
            SaslMechanismInformation.Names.IEC_ISO_9798_M_DSA_SHA1,
            SaslMechanismInformation.Names.IEC_ISO_9798_U_ECDSA_SHA1,
            SaslMechanismInformation.Names.IEC_ISO_9798_M_ECDSA_SHA1 }, mechanisms);

    // Request server auth
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    mechanisms = factory.getMechanismNames(props);
    assertMechanisms(new String[] { SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC,
            SaslMechanismInformation.Names.IEC_ISO_9798_M_DSA_SHA1,
            SaslMechanismInformation.Names.IEC_ISO_9798_M_ECDSA_SHA1 }, mechanisms);
}