Skip to content

Commit 9ae6445

Browse files
committed
Merge pull request #750 from mattberther/scram-support
add ability to specify SCRAM-SHA-1 as authMechanism on uri
2 parents d053755 + 96337c6 commit 9ae6445

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/mongo/uri.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ class URI
168168
#
169169
# @since 2.0.0
170170
AUTH_MECH_MAP = {
171-
'PLAIN' => :plain,
172-
'MONGODB-CR' => :mongodb_cr,
173-
'GSSAPI' => :gssapi
171+
'PLAIN' => :plain,
172+
'MONGODB-CR' => :mongodb_cr,
173+
'GSSAPI' => :gssapi,
174+
'SCRAM-SHA-1' => :scram
174175
}.freeze
175176

176177
# Options that are allowed to appear more than once in the uri.

spec/mongo/uri_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,19 @@
524524
let(:mechanism) { 'GSSAPI' }
525525
let(:expected) { :gssapi }
526526

527-
528527
it 'sets the auth mechanism to :gssapi' do
529528
expect(uri.uri_options[:auth_mech]).to eq(expected)
530529
end
531530
end
531+
532+
context 'scram-sha-1' do
533+
let(:mechanism) { 'SCRAM-SHA-1' }
534+
let(:expected) { :scram }
535+
536+
it 'sets the auth mechanism to :scram' do
537+
expect(uri.uri_options[:auth_mech]).to eq(expected)
538+
end
539+
end
532540
end
533541

534542
context 'auth source provided' do

0 commit comments

Comments
 (0)