code: def auth(context, request):
      
  
      if ploneapi.user.is_anonymous():
          request.response.setStatus(401)
          request.response.setHeader('WWW-Authenticate',
                                     'basic realm="JSONAPI AUTH"', 1)
  
      logger.info("*** BASIC AUTHENTICATE ***")
      return {}
docs: Basic Authentication