Example usage for org.apache.zookeeper.server.auth SaslServerCallbackHandler SaslServerCallbackHandler

List of usage examples for org.apache.zookeeper.server.auth SaslServerCallbackHandler SaslServerCallbackHandler

Introduction

In this page you can find the example usage for org.apache.zookeeper.server.auth SaslServerCallbackHandler SaslServerCallbackHandler.

Prototype

public SaslServerCallbackHandler(Configuration configuration) throws IOException 

Source Link

Usage

From source file:org.apache.hadoop.registry.secure.TestSecureRegistry.java

License:Apache License

/**
* this is a cut and paste of some of the ZK internal code that was
 * failing on windows and swallowing its exceptions
 *///  w  ww  . j  a  v  a2 s . c  om
@Test
public void testLowlevelZKSaslLogin() throws Throwable {
    RegistrySecurity.bindZKToServerJAASContext(ZOOKEEPER_SERVER_CONTEXT);
    String serverSection = System.getProperty(ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY,
            ZooKeeperSaslServer.DEFAULT_LOGIN_CONTEXT_NAME);
    assertEquals(ZOOKEEPER_SERVER_CONTEXT, serverSection);

    AppConfigurationEntry entries[];
    entries = javax.security.auth.login.Configuration.getConfiguration()
            .getAppConfigurationEntry(serverSection);

    assertNotNull("null entries", entries);

    SaslServerCallbackHandler saslServerCallbackHandler = new SaslServerCallbackHandler(
            javax.security.auth.login.Configuration.getConfiguration());
    Login login = new Login(serverSection, saslServerCallbackHandler);
    try {
        login.startThreadIfNeeded();
    } finally {
        login.shutdown();
    }
}