Search in sources :

Example 6 with Id

use of org.apache.zookeeper_voltpatches.data.Id in project voltdb by VoltDB.

the class Id method compareTo.

public int compareTo(Object peer_) throws ClassCastException {
    if (!(peer_ instanceof Id)) {
        throw new ClassCastException("Comparing different types of records.");
    }
    Id peer = (Id) peer_;
    int ret = 0;
    ret = scheme.compareTo(peer.scheme);
    if (ret != 0)
        return ret;
    ret = id.compareTo(peer.id);
    if (ret != 0)
        return ret;
    return ret;
}
Also used : Id(org.apache.zookeeper_voltpatches.data.Id)

Example 7 with Id

use of org.apache.zookeeper_voltpatches.data.Id in project voltdb by VoltDB.

the class DigestAuthenticationProvider method handleAuthentication.

public KeeperException.Code handleAuthentication(ServerCnxn cnxn, byte[] authData) {
    String id = new String(authData);
    try {
        String digest = generateDigest(id);
        if (digest.equals(superDigest)) {
            cnxn.getAuthInfo().add(new Id("super", ""));
        }
        cnxn.getAuthInfo().add(new Id(getScheme(), digest));
        return KeeperException.Code.OK;
    } catch (NoSuchAlgorithmException e) {
        LOG.error("Missing algorithm", e);
    }
    return KeeperException.Code.AUTHFAILED;
}
Also used : Id(org.apache.zookeeper_voltpatches.data.Id) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Aggregations

Id (org.apache.zookeeper_voltpatches.data.Id)7 ACL (org.apache.zookeeper_voltpatches.data.ACL)2 ByteBuffer (java.nio.ByteBuffer)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 LinkedList (java.util.LinkedList)1 Request (org.apache.zookeeper_voltpatches.server.Request)1 AuthenticationProvider (org.apache.zookeeper_voltpatches.server.auth.AuthenticationProvider)1