Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-162

Patch for pymongo.Connection to perform automatic per-socket authentication for databases after first authentication

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Major Change
    • # Replies:
      7
    • Last comment by Customer:
      true

      Description

      I have a proposed patch for pymongo that allows the Connection class to perform automatic per-socket authentication for databases across threads and sockets. Once a user authenticates to a database the first time in a given Connection, all future sockets created by that connection are logged-in immediately with no further action required by the user.

      This feature is intended to make it easier to efficiently use MongoDB's auth within multi-threaded web frameworks, without the need for pymongo users to preemptively authenticate connections themselves or detect and remedy exceptions caused by auth failures.

      The changeset includes unit tests that exercise the authentication in single- and multi-threaded scenarios – these tests are skipped if the local server does not have auth enabled. I have also updated the corresponding API documentation, though this needs more work.

      Pull request: http://github.com/mongodb/mongo-python-driver/pull/6

      Note that the modifications to Database.authenticate change the meaning and implications of authenticating, and so may not be backwards compatible with code that relies upon the existing per-socket-only authentication.

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                7 years, 18 weeks, 6 days ago
                Date of 1st Reply: