Class: Mongo::Auth::CR::Conversation Deprecated Private

Inherits:
Mongo::Auth::ConversationBase show all
Defined in:
build/ruby-driver-master/lib/mongo/auth/cr/conversation.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Deprecated.

MONGODB-CR authentication mechanism is deprecated as of MongoDB 3.6. Support for it in the Ruby driver will be removed in driver version 3.0. Please use SCRAM instead.

Defines behavior around a single MONGODB-CR conversation between the client and server.

Since:

  • 2.0.0

Constant Summary collapse

LOGIN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The login message base.

Since:

  • 2.0.0

{ authenticate: 1 }.freeze

Instance Attribute Summary collapse

Attributes inherited from Mongo::Auth::ConversationBase

#connection, #user

Instance Method Summary collapse

Methods inherited from Mongo::Auth::ConversationBase

#build_message, #initialize, #speculative_auth_document, #validate_external_auth_source

Constructor Details

This class inherits a constructor from Mongo::Auth::ConversationBase

Instance Attribute Details

#databaseString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns database The database to authenticate against.

Returns:

  • (String)

    database The database to authenticate against.

Since:

  • 2.0.0



38
39
40
# File 'build/ruby-driver-master/lib/mongo/auth/cr/conversation.rb', line 38

def database
  @database
end

#nonceString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns nonce The initial auth nonce.

Returns:

  • (String)

    nonce The initial auth nonce.

Since:

  • 2.0.0



41
42
43
# File 'build/ruby-driver-master/lib/mongo/auth/cr/conversation.rb', line 41

def nonce
  @nonce
end

Instance Method Details

#continue(reply_document, connection) ⇒ Protocol::Message

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Continue the CR conversation. This sends the client final message to the server after setting the reply from the previous server communication.

Parameters:

  • reply_document (BSON::Document)

    The reply document of the previous message.

  • connection (Mongo::Server::Connection)

    The connection being authenticated.

Returns:

Since:

  • 2.0.0



69
70
71
72
73
# File 'build/ruby-driver-master/lib/mongo/auth/cr/conversation.rb', line 69

def continue(reply_document, connection)
  @nonce = reply_document[Auth::NONCE]
  selector = LOGIN.merge(user: user.name, nonce: nonce, key: user.auth_key(nonce))
  build_message(connection, user.auth_source, selector)
end

#start(connection) ⇒ Protocol::Message

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start the CR conversation. This returns the first message that needs to be sent to the server.

Parameters:

Returns:

Since:

  • 2.0.0



52
53
54
55
# File 'build/ruby-driver-master/lib/mongo/auth/cr/conversation.rb', line 52

def start(connection)
  selector = Auth::GET_NONCE
  build_message(connection, user.auth_source, selector)
end