module Mongo::Auth

This namespace contains all authentication related behavior.

@since 2.0.0

Constants

EXTERNAL

The external database name.

@since 2.0.0

GET_NONCE

Constant for the nonce command.

@since 2.0.0

NONCE

Constant for the nonce field.

@since 2.0.0

SOURCES

Map the symbols parsed from the URI connection string to strategies.

@since 2.0.0

Public Instance Methods

get(user) click to toggle source

Get the authorization strategy for the provided auth mechanism.

@example Get the strategy.

Auth.get(user)

@param [ Auth::User ] user The user object.

@return [ CR, X509, LDAP, Kerberos ] The auth strategy.

@since 2.0.0

# File lib/mongo/auth.rb, line 67
def get(user)
  mechanism = user.mechanism
  raise InvalidMechanism.new(mechanism) if !SOURCES.has_key?(mechanism)
  SOURCES[mechanism].new(user)
end