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

[DOC] improvement about

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.4.1
    • Fix Version/s: None
    • Component/s: Authentication
    • Labels:
      None
    • Environment:
      MRI 2.4.0

      Description

      in `Mongo::Server::Connection#authenticate!`
      there is a logical test that read as :

      ```
      if options[:user] || options[:auth_mech]
      ...
      end
      ```

      That seems incorrect in case the .yml file has no :user entry but a :auth_mech is provided.

      In that case, the Authenticate! could be called with a Nil for user and then code calling
      @user.xxx will fails miserably.

      It seems to me, that the mongoid.yml file sample, should point out, that in case of 'no security', the
      `auth_mech` should not by set.

      Or the logic test in code, should test as :

      ```
      def authenticate!
      if options[:user] || options[:auth_mech]
      user = Auth::User.new(Options::Redacted.new(:auth_mech => default_mechanism).merge(options))
      @server.handle_auth_failure! do
      Auth.get(user).login(self)
      end
      end
      end
      ```

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: