mongo 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo/address.rb +70 -11
- data/lib/mongo/address/ipv4.rb +23 -22
- data/lib/mongo/address/ipv6.rb +23 -22
- data/lib/mongo/address/unix.rb +18 -18
- data/lib/mongo/auth.rb +0 -1
- data/lib/mongo/auth/cr.rb +21 -2
- data/lib/mongo/auth/cr/conversation.rb +7 -4
- data/lib/mongo/auth/ldap.rb +14 -1
- data/lib/mongo/auth/scram.rb +15 -1
- data/lib/mongo/auth/scram/conversation.rb +3 -3
- data/lib/mongo/auth/user.rb +1 -1
- data/lib/mongo/auth/x509.rb +15 -1
- data/lib/mongo/cluster.rb +22 -8
- data/lib/mongo/cluster/topology.rb +7 -6
- data/lib/mongo/cluster/topology/replica_set.rb +5 -5
- data/lib/mongo/cluster/topology/sharded.rb +5 -5
- data/lib/mongo/cluster/topology/{standalone.rb → single.rb} +26 -22
- data/lib/mongo/cluster/topology/unknown.rb +6 -5
- data/lib/mongo/collection.rb +6 -1
- data/lib/mongo/collection/view.rb +1 -0
- data/lib/mongo/collection/view/readable.rb +5 -0
- data/lib/mongo/error.rb +4 -0
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +36 -0
- data/lib/mongo/error/invalid_uri.rb +37 -0
- data/lib/mongo/error/invalid_uri_option.rb +38 -0
- data/lib/mongo/error/no_server_available.rb +37 -0
- data/lib/mongo/operation/read_preferrable.rb +20 -4
- data/lib/mongo/protocol/query.rb +14 -1
- data/lib/mongo/server.rb +12 -0
- data/lib/mongo/server/connectable.rb +5 -1
- data/lib/mongo/server/connection.rb +1 -1
- data/lib/mongo/server/context.rb +2 -1
- data/lib/mongo/server_selector.rb +0 -19
- data/lib/mongo/server_selector/selectable.rb +4 -22
- data/lib/mongo/uri.rb +9 -55
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/address/ipv4_spec.rb +27 -6
- data/spec/mongo/address/ipv6_spec.rb +27 -6
- data/spec/mongo/address/unix_spec.rb +15 -4
- data/spec/mongo/auth/cr_spec.rb +2 -2
- data/spec/mongo/auth/ldap_spec.rb +2 -2
- data/spec/mongo/auth/scram_spec.rb +2 -2
- data/spec/mongo/auth/x509_spec.rb +2 -2
- data/spec/mongo/client_spec.rb +8 -0
- data/spec/mongo/cluster/topology/replica_set_spec.rb +6 -6
- data/spec/mongo/cluster/topology/sharded_spec.rb +5 -5
- data/spec/mongo/cluster/topology/{standalone_spec.rb → single_spec.rb} +7 -7
- data/spec/mongo/cluster/topology_spec.rb +31 -5
- data/spec/mongo/cluster_spec.rb +103 -21
- data/spec/mongo/collection/view/readable_spec.rb +18 -7
- data/spec/mongo/collection/view_spec.rb +13 -0
- data/spec/mongo/collection_spec.rb +7 -0
- data/spec/mongo/database_spec.rb +2 -2
- data/spec/mongo/protocol/query_spec.rb +29 -0
- data/spec/mongo/server/connection_pool_spec.rb +4 -4
- data/spec/mongo/server/connection_spec.rb +46 -10
- data/spec/mongo/server/monitor_spec.rb +2 -2
- data/spec/mongo/server_discovery_and_monitoring_spec.rb +23 -0
- data/spec/mongo/server_selection_rtt_spec.rb +2 -1
- data/spec/mongo/server_selection_spec.rb +6 -15
- data/spec/mongo/server_selector/nearest_spec.rb +1 -1
- data/spec/mongo/server_selector_spec.rb +53 -2
- data/spec/mongo/server_spec.rb +9 -9
- data/spec/mongo/socket/ssl_spec.rb +1 -1
- data/spec/mongo/uri_spec.rb +2 -2
- data/spec/spec_helper.rb +34 -5
- data/spec/support/authorization.rb +32 -46
- data/spec/support/server_discovery_and_monitoring.rb +1 -1
- data/spec/support/server_selection.rb +1 -25
- data/spec/support/shared/operation.rb +3 -0
- data/spec/support/shared/server_selector.rb +1 -1
- metadata +10 -7
- metadata.gz.sig +0 -0
- data/lib/mongo/auth/executable.rb +0 -52
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Copyright (C) 2014-2015 MongoDB Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Mongo
|
16
|
-
module Auth
|
17
|
-
|
18
|
-
# Defines common behaviour for executable authorization commands.
|
19
|
-
#
|
20
|
-
# @since 2.0.0
|
21
|
-
module Executable
|
22
|
-
|
23
|
-
# @return [ Mongo::Auth::User ] The user to authenticate.
|
24
|
-
attr_reader :user
|
25
|
-
|
26
|
-
# Instantiate a new authenticator.
|
27
|
-
#
|
28
|
-
# @example Create the authenticator.
|
29
|
-
# Mongo::Auth::X509.new(user)
|
30
|
-
#
|
31
|
-
# @param [ Mongo::Auth::User ] user The user to authenticate.
|
32
|
-
#
|
33
|
-
# @since 2.0.0
|
34
|
-
def initialize(user)
|
35
|
-
@user = user
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
# If we are on MongoDB 2.6 and higher, we *always* authorize against the
|
41
|
-
# admin database. Otherwise for 2.4 and lower we authorize against the
|
42
|
-
# auth source provided. The logic for that is encapsulated in the User class.
|
43
|
-
def auth_database(connection)
|
44
|
-
if connection.features.write_command_enabled?
|
45
|
-
Database::ADMIN
|
46
|
-
else
|
47
|
-
user.auth_source
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|