'Handle a message from front-end API.'

def _handle_pipe(self):

    terminate = False
    msg = self.pipe.recv_multipart()
    if (msg is None):
        terminate = True
        return terminate
    command = msg[0]
    self.log.debug('auth    received    API    command    %r', command)
    if (command == 'ALLOW'):
        addresses = [u(m, self.encoding) for m in msg[1:]]
        try:
            self.authenticator.allow(*addresses)
        except Exception as e:
            self.log.exception('Failed    to    allow    %s', addresses)
    elif (command == 'DENY'):
        addresses = [u(m, self.encoding) for m in msg[1:]]
        try:
            self.authenticator.deny(*addresses)
        except Exception as e:
            self.log.exception('Failed    to    deny    %s', addresses)
    elif (command == 'PLAIN'):
        domain = u(msg[1], self.encoding)
        json_passwords = msg[2]
        self.authenticator.configure_plain(domain, jsonapi.loads(json_passwords))
    elif (command == 'CURVE'):
        domain = u(msg[1], self.encoding)
        location = u(msg[2], self.encoding)
        self.authenticator.configure_curve(domain, location)
    elif (command == 'TERMINATE'):
        terminate = True
    else:
        self.log.error('Invalid    auth    command    from    API:    %r', command)
    return terminate
