Class: Mongo::Auth::Aws::Conversation Private

Inherits:
SaslConversationBase show all
Defined in:
build/ruby-driver-v2.19/lib/mongo/auth/aws/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.

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

Constant Summary

Constants inherited from SaslConversationBase

SaslConversationBase::CLIENT_CONTINUE_MESSAGE, SaslConversationBase::CLIENT_FIRST_MESSAGE

Instance Attribute Summary

Attributes inherited from ConversationBase

#connection, #user

Instance Method Summary collapse

Methods inherited from SaslConversationBase

#start

Methods inherited from ConversationBase

#build_message, #initialize, #speculative_auth_document, #validate_external_auth_source

Constructor Details

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

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 AWS 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 (Server::Connection)

    The connection being authenticated.

Returns:

Since:

  • 2.0.0



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'build/ruby-driver-v2.19/lib/mongo/auth/aws/conversation.rb', line 40

def continue(reply_document, connection)
  @conversation_id = reply_document[:conversationId]
  payload = reply_document[:payload].data
  payload = BSON::Document.from_bson(BSON::ByteBuffer.new(payload))
  @server_nonce = payload[:s].data
  validate_server_nonce!
  @sts_host = payload[:h]
  unless (1..255).include?(@sts_host.bytesize)
    raise Error::InvalidServerAuthConfiguration, "STS host name length is not in 1..255 bytes range: #{@sts_host}"
  end

  selector = CLIENT_CONTINUE_MESSAGE.merge(
    payload: BSON::Binary.new(client_final_payload),
    conversationId: conversation_id,
  )
  build_message(connection, user.auth_source, selector)
end