class Mongo::Auth::X509::Conversation

Defines behavior around a single X.509 conversation between the client and server.

@since 2.0.0 @api private

Constants

LOGIN

The login message.

@since 2.0.0

Public Instance Methods

speculative_auth_document() click to toggle source

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

If the auth mechanism does not support speculative authentication, this method returns nil.

@return [ Hash | nil ] Speculative authentication document.

# File lib/mongo/auth/x509/conversation.rb, line 55
def speculative_auth_document
  client_first_document
end
start(connection) click to toggle source

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

@param [ Server::Connection ] connection The connection being

authenticated.

@return [ Protocol::Message ] The first X.509 conversation message.

@since 2.0.0

# File lib/mongo/auth/x509/conversation.rb, line 42
def start(connection)
  validate_external_auth_source
  selector = client_first_document
  build_message(connection, '$external', selector)
end

Private Instance Methods

client_first_document() click to toggle source
# File lib/mongo/auth/x509/conversation.rb, line 61
def client_first_document
  LOGIN.dup.tap do |payload|
    payload[:user] = user.name if user.name
  end
end