Example usage for javax.security.sasl SaslServer getMechanismName

List of usage examples for javax.security.sasl SaslServer getMechanismName

Introduction

In this page you can find the example usage for javax.security.sasl SaslServer getMechanismName.

Prototype

public abstract String getMechanismName();

Source Link

Document

Returns the IANA-registered mechanism name of this SASL server.

Usage

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

@Test
public void testServerAuthIndirect_Server() throws Exception {
    Map<String, Object> props = new HashMap<String, Object>();

    // No properties are set, an appropriate EntitySaslServer should be returned
    SaslServer server = Sasl.createSaslServer(SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
            "TestProtocol", "TestServer", props, null);
    assertEquals(EntitySaslServer.class, server.getClass());
    assertEquals(SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC, server.getMechanismName());

    // If we set SERVER_AUTH to true even though a unilateral mechanism is specified, no server should be returned
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    server = Sasl.createSaslServer(SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC, "TestProtocol",
            "TestServer", props, null);
    assertNull(server);//from  w ww  .java 2  s  .  co m
}