123456789_123456789_123456789_123456789_123456789_

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

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Mongo::Auth::ConversationBase
Defined in: lib/mongo/auth/cr/conversation.rb

Overview

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

Class Method Summary

::Mongo::Auth::ConversationBase - Inherited

.new

Create the new conversation.

Instance Attribute Summary

::Mongo::Auth::ConversationBase - Inherited

Instance Method Summary

::Mongo::Auth::ConversationBase - Inherited

#build_message,
#speculative_auth_document

Returns the hash to provide to the server in the handshake as value of the speculativeAuthenticate key.

#validate_external_auth_source

Instance Attribute Details

#databaseString (readonly)

Returns:

  • (String)

    database The database to authenticate against.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/cr/conversation.rb', line 38

attr_reader :database

#nonceString (readonly)

Returns:

  • (String)

    nonce The initial auth nonce.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/cr/conversation.rb', line 41

attr_reader :nonce

Instance Method Details

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

Continue the ::Mongo::Auth::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

[ GitHub ]

  
# File '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

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

Parameters:

Returns:

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/cr/conversation.rb', line 52

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