Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-735

Authentication should fail gracefully with invalid auth mechanism

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.12, 2.0.0
    • Affects Version/s: 1.10.0
    • Component/s: Auth
    • 1

      When connecting using a connection string, attempting to use a bogus auth mechanism results in a descriptive error message:

      > uri = "mongodb://user:pwd@host:port/example?authSource=$external&authMechanism=FAKE_METHOD"
      > new_client = MongoClient.from_uri(uri)
      Invalid value "fake_method" for authmechanism: must be one of GSSAPI, MONGODB-CR, MONGODB-X509, PLAIN
      

      However if we authenticate through code, we get a less descriptive error message:

      > client = MongoClient.new("host", port)
      > db = client.db("database")
      > db.authenticate(user, pwd, nil, "$external", FAKE_METHOD)
      undefined method `[]' for nil:NilClass
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: