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

Auth exceptions should include server information

    • Fully Compatible

      When auth fails, the current diagnostic output includes the mechanism provided with the credentials as well as the negotiated (i.e. actually used) mechanism. In addition, the following information should be included:

      • Address (probably the address string of the server) that the authentication was attempted against
      • Summary of the target server (via Server#summary method)

      This is to, in particular, aid in catching instances of authentication attempts against arbiters which does not work (and the driver should not perform, per https://jira.mongodb.org/browse/RUBY-1890).

      Example current output:

      Mongo::Auth::Unauthorized: User test-user (mechanism: scram) is not authorized to access ruby-driver (used mechanism: SCRAM-SHA-1)
      
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/auth/scram/conversation.rb:522:in `validate!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/auth/scram/conversation.rb:516:in `validate_first_message!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/auth/scram/conversation.rb:112:in `continue'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/auth/scram.rb:73:in `login'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection.rb:360:in `block in authenticate!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server.rb:422:in `handle_auth_failure!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection.rb:358:in `authenticate!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection.rb:182:in `do_connect'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection.rb:163:in `connect!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection_pool.rb:678:in `connect_connection'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection_pool.rb:644:in `create_and_add_connection'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection_pool.rb:578:in `populate'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/server/connection_pool/connection_pool_populator.rb:43:in `do_work'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/background_thread.rb:98:in `block (2 levels) in start!'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/background_thread.rb:96:in `catch'
      /data/mci/a11f899c0afea91a64f646869819db90/src/lib/mongo/background_thread.rb:96:in `block in start!'
      

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: