Module: Mongo::Auth
Overview
This namespace contains all authentication related behavior.
Constant Summary
-
EXTERNAL =
Internal use only
The external database name.
'$external'.freeze
-
GET_NONCE =
Internal use only
Constant for the nonce command.
{ getnonce: 1 }.freeze
-
NONCE =
Internal use only
Constant for the nonce field.
'nonce'.freeze
-
SOURCES =
Note:
This map is not frozen because when mongo_kerberos is loaded, it mutates this map by adding the Kerberos authenticator.
Map the symbols parsed from the
URI
connection string to strategies.{ aws: Aws, gssapi: Gssapi, mongodb_cr: CR, mongodb_x509: X509, plain: LDAP, scram: Scram, scram256: Scram256, }
Instance Method Summary
-
#get(user, connection, **opts) ⇒ Auth::Aws | Auth::CR | Auth::Gssapi | Auth::LDAP | Auth::Scram | Auth::Scram256 | Auth::X509
Internal use only
Internal use only
Get an authenticator for the provided user to authenticate over the provided connection.
Instance Method Details
#get(user, connection, **opts) ⇒ Auth::Aws | Auth::CR | Auth::Gssapi | Auth::LDAP | Auth::Scram | Auth::Scram256 | Auth::X509
This method is for internal use only.
Get an authenticator for the provided user to authenticate over the provided connection.
# File 'lib/mongo/auth.rb', line 97
def get(user, connection, **opts) mechanism = user.mechanism raise InvalidMechanism.new(mechanism) if !SOURCES.has_key?(mechanism) SOURCES[mechanism].new(user, connection, **opts) end