123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Auth::Gssapi::Conversation 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::SaslConversationBase
Defined in: lib/mongo/auth/gssapi/conversation.rb

Overview

Defines behaviour around a single Kerberos conversation between the client and the server.

Since:

  • 2.0.0

Constant Summary

::Mongo::Auth::SaslConversationBase - Inherited

CLIENT_CONTINUE_MESSAGE, CLIENT_FIRST_MESSAGE

Class Method Summary

::Mongo::Auth::ConversationBase - Inherited

.new

Create the new conversation.

Instance Attribute Summary

::Mongo::Auth::ConversationBase - Inherited

Instance Method Summary

::Mongo::Auth::SaslConversationBase - Inherited

#start

Start the SASL conversation.

#auth_mechanism_name

Gets the auth mechanism name for the conversation class.

#client_first_document, #client_first_message_options,
#validate_server_nonce!

Helper method to validate that server nonce starts with the client nonce.

::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

#authenticatorAuthenticator (readonly)

Returns:

  • (Authenticator)

    authenticator The native SASL authenticator.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 59

attr_reader :authenticator

#idInteger (readonly)

Get the id of the conversation.

Returns:

  • (Integer)

    The conversation id.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 64

attr_reader :id

Instance Method Details

#client_first_document

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 66

def client_first_document
  start_token = authenticator.initialize_challenge
  START_MESSAGE.merge(mechanism: Gssapi::MECHANISM, payload: start_token)
end

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

Continue the conversation.

Parameters:

  • reply_document (BSON::Document)

    The reply document of the previous message.

Returns:

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 77

def continue(reply_document, connection)
  @id = reply_document['conversationId']
  payload = reply_document['payload']

  continue_token = authenticator.evaluate_challenge(payload)
  selector = CONTINUE_MESSAGE.merge(payload: continue_token, conversationId: id)
  build_message(connection, '$external', selector)
end

#finalize(connection) ⇒ Protocol::Message

Returns:

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 93

def finalize(connection)
  selector = CONTINUE_MESSAGE.merge(payload: @continue_token, conversationId: id)
  build_message(connection, '$external', selector)
end

#process_continue_response(reply_document)

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/auth/gssapi/conversation.rb', line 86

def process_continue_response(reply_document)
  payload = reply_document['payload']

  @continue_token = authenticator.evaluate_challenge(payload)
end