class_docstr: Implementation of ZAP authentication for zmq connections.
  
  This authenticator class does not register with an event loop. As a result,
  you will need to manually call `handle_zap_message`::
  
      auth = zmq.Authenticator()
      auth.allow("127.0.0.1")
      auth.start()
      while True:
          await auth.handle_zap_msg(auth.zap_socket.recv_multipart())
  
  Alternatively, you can register `auth.zap_socket` with a poller.
  
  Since many users will want to run ZAP in a way that does not block the
  main thread, other authentication classes (such as :mod:`zmq.auth.thread`)
  are provided.
  
  Note:
  
  - libzmq provides four levels of security: default NULL (which the Authenticator does
    not see), and authenticated NULL, PLAIN, CURVE, and GSSAPI, which the Authenticator can see.
  - until you add policies, all incoming NULL connections are allowed.
    (classic ZeroMQ behavior), and all PLAIN and CURVE connections are denied.
  - GSSAPI requires no configuration.
class_docstr_tok: ["Implementation","of","ZAP","authentication","for","zmq","connections",".","This","authenticator","class","does","not","register","with","an","event","loop",".","As","a","result",",","you","will","need","to","manually","call","`","handle_zap_message","`",":",":","auth","=","zmq.Authenticator","(",")","auth.allow","(","``","127.0.0.1","''",")","auth.start","(",")","while","True",":","await","auth.handle_zap_msg","(","auth.zap_socket.recv_multipart","(",")",")","Alternatively",",","you","can","register","`","auth.zap_socket","`","with","a","poller",".","Since","many","users","will","want","to","run","ZAP","in","a","way","that","does","not","block","the","main","thread",",","other","authentication","classes","(","such","as",":","mod",":","`","zmq.auth.thread","`",")","are","provided",".","Note",":","-","libzmq","provides","four","levels","of","security",":","default","NULL","(","which","the","Authenticator","does","not","see",")",",","and","authenticated","NULL",",","PLAIN",",","CURVE",",","and","GSSAPI",",","which","the","Authenticator","can","see",".","-","until","you","add","policies",",","all","incoming","NULL","connections","are","allowed",".","(","classic","ZeroMQ","behavior",")",",","and","all","PLAIN","and","CURVE","connections","are","denied",".","-","GSSAPI","requires","no","configuration","."]
docstr: Configure CURVE authentication for a given domain.
  
  CURVE authentication using a callback function validating
  the client public key according to a custom mechanism, e.g. checking the
  key against records in a db. credentials_provider is an object of a class which
  implements a callback method accepting two parameters (domain and key), e.g.::
  
      class CredentialsProvider(object):
  
          def __init__(self):
              ...e.g. db connection
  
          def callback(self, domain, key):
              valid = ...lookup key and/or domain in db
              if valid:
                  logging.info('Authorizing: {0}, {1}'.format(domain, key))
                  return True
              else:
                  logging.warning('NOT Authorizing: {0}, {1}'.format(domain, key))
                  return False
  
  To cover all domains, use "*".
docstr_tok: ["Configure","CURVE","authentication","for","a","given","domain",".","CURVE","authentication","using","a","callback","function","validating","the","client","public","key","according","to","a","custom","mechanism",",","e.g",".","checking","the","key","against","records","in","a","db",".","credentials_provider","is","an","object","of","a","class","which","implements","a","callback","method","accepting","two","parameters","(","domain","and","key",")",",","e.g",".",":",":","class","CredentialsProvider","(","object",")",":","def","__init__","(","self",")",":","...","e.g",".","db","connection","def","callback","(","self",",","domain",",","key",")",":","valid","=","...","lookup","key","and\/or","domain","in","db","if","valid",":","logging.info","(","'Authorizing",":","{","0","}",",","{","1","}","'.format","(","domain",",","key",")",")","return","True","else",":","logging.warning","(","'NOT","Authorizing",":","{","0","}",",","{","1","}","'.format","(","domain",",","key",")",")","return","False","To","cover","all","domains",",","use","``","*","''","."]
code: def configure_curve_callback(
      self, domain: str = "*", credentials_provider: Any = None
  ) -> None:
      """Configure CURVE authentication for a given domain.
  
      CURVE authentication using a callback function validating
      the client public key according to a custom mechanism, e.g. checking the
      key against records in a db. credentials_provider is an object of a class which
      implements a callback method accepting two parameters (domain and key), e.g.::
  
          class CredentialsProvider(object):
  
              def __init__(self):
                  ...e.g. db connection
  
              def callback(self, domain, key):
                  valid = ...lookup key and/or domain in db
                  if valid:
                      logging.info('Authorizing: {0}, {1}'.format(domain, key))
                      return True
                  else:
                      logging.warning('NOT Authorizing: {0}, {1}'.format(domain, key))
                      return False
  
      To cover all domains, use "*".
      """
  
      self.allow_any = False
  
      if credentials_provider is not None:
          self.credentials_providers[domain] = credentials_provider
      else:
          self.log.error(
              "None credentials_provider provided for domain:%s", domain
          )
  
imports: import logging
  import os
  from typing import Any, Awaitable, Dict, List, Optional, Set, Tuple, Union
  import zmq
  from zmq.error import _check_version
  from zmq.utils import z85
  from .certs import load_certificates
label_desc: Use image node_id 8 for calling the Authenticator obj's underlying member method code with example usage: obj.configure_curve_callback(domain, credentials_provider) without return types