Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3974

Is it possible to authenticate with user from admin db?

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      My app uses multiple databases. I'd like to authenticate with a user stored in the admin db that has readWriteAnyDatabase permissions.

      Currently, my mongoid.yml looks something like this:

      production:
        sessions:
          default:
            hosts:
              - my.mongo.com:27017
            database: default_db
            username: admin_user
            password: admin_pw
      

      The problem is that Mongoid will authenticate with admin_user@default_db instead of admin_user@admin. So authentication always ends up failing

      I'd like to keep default_db as my default database, but I'd also like to authenticate with admin_user@admin. Is there a good way to accomplish this?

      (Here's someone else dealing with the same issue)

            Assignee:
            Unassigned Unassigned
            Reporter:
            fedenusy fedenusy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: