Class Moped::Protocol::Commands::Authenticate
In: lib/moped/protocol/commands/authenticate.rb
Parent: Command

Implementation of the authentication command for Mongo. See: www.mongodb.org/display/DOCS/Implementing+Authentication+in+a+Driver for details.

@example

  socket.write Command.new :admin, getnonce: 1
  reply = Reply.deserialize socket
  socket.write Authenticate.new :admin, "username", "password",
    reply.documents[0]["nonce"]
  Reply.deserialize(socket).documents[0]["ok"] # => 1.0

Methods

Public Class methods

Create a new authentication command.

@param [String] database the database to authenticate against @param [String] username @param [String] password @param [String] nonce the nonce returned from running the getnonce command.

Public Instance methods

@param [String] username @param [String] password @param [String] nonce

@param [String] username @param [String] password @param [String] nonce @return [String] the mongo digest of the username, password, and nonce.

[Validate]