Example usage for org.apache.zookeeper.server ServerCnxn addAuthInfo

List of usage examples for org.apache.zookeeper.server ServerCnxn addAuthInfo

Introduction

In this page you can find the example usage for org.apache.zookeeper.server ServerCnxn addAuthInfo.

Prototype

public void addAuthInfo(Id id) 

Source Link

Usage

From source file:morello.zk.acl.CustomUserAuthenticationProvider.java

License:Apache License

@Override
public Code handleAuthentication(ServerCnxn cnxn, byte[] authData) {
    final String userName = new String(authData, Charsets.UTF_8);
    // A non null or empty user name must be provided
    if (!Strings.isNullOrEmpty(userName)) {
        // This line is VERY important ! return code is not enough
        cnxn.addAuthInfo(new Id(getScheme(), userName));
        return Code.OK;
    }/*w  w w  .j  a va2 s .c o m*/
    return Code.AUTHFAILED;
}

From source file:org.trustedanalytics.auth.gateway.zookeeper.integration.testserver.BackdoorAuthProvider.java

License:Apache License

@Override
public KeeperException.Code handleAuthentication(ServerCnxn serverCnxn, byte[] bytes) {
    serverCnxn.addAuthInfo(new Id("super", ""));
    return KeeperException.Code.OK;
}