-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoDB version 3.0+ uses SCRAM-SHA-1 as default auth mechanism #1967
Comments
I believe this was mention a few time in other issues. |
What Vibe.d version were you using? This has been fixed a couple of months ago: #1843 (part of v0.8.1) |
I'm able to reproduce this with |
Hmm, the patch is included in v0.8.1 and I remember needing this patch for deploying something to Heroku. |
Okay, so looking at the code: if (m_settings.authMechanism == MongoAuthMechanism.none)
authenticate();
else
{
try
scramAuthenticate();
catch (MongoAuthException e)
authenticate();
} This doesn't make sense. The only place that ever modifies if (m_settings.authMechanism == MongoAuthMechanism.mongoDBCR)
authenticate(); //use old mechanism if explicitly stated
else
{
try
scramAuthenticate(); //scram-sha-1 is default in version v3.0+
catch (MongoAuthException e)
authenticate(); //fall back if scram-sha-1 fails
} |
@ahmetsait I just submitted your suggestion -> #2027 Did you manage to get it to work on your machine? |
@wilzbach As far as I remember, it works with the change I suggested but I don't use mongodb and I don't have mongodb installed anymore (I don't feel like messing with it again) so I don't want to re-check it all over again unless you absolutely want me to. Nevertheless, LGTM :) |
Closing it since #2027 is merged. The old mechanism is also no longer available:
|
MongoDB Documentation:
I realized this after enabling authentication on my mongod config because using
mongodb://user:password@host/database
as connection url kept failing. I had to specify auth mechanism like so:mongodb://user:password@host/database?authMechanism=SCRAM-SHA-1
So I guess the default auth mechanism should be determined according to MongoDB version.
Also, error messages can use some improvements (at least error codes instead of just "Authentication failed" message).
The text was updated successfully, but these errors were encountered: