lib/mongo/auth/ldap/conversation.rb in mongo-2.7.2 vs lib/mongo/auth/ldap/conversation.rb in mongo-2.8.0.rc0
- old
+ new
@@ -49,11 +49,11 @@
def finalize(reply)
validate!(reply)
end
# Start the PLAIN conversation. This returns the first message that
- # needs to be send to the server.
+ # needs to be sent to the server.
#
# @example Start the conversation.
# conversation.start
#
# @param [ Mongo::Server::Connection ] connection The connection being authenticated.
@@ -95,10 +95,12 @@
def payload
BSON::Binary.new("\x00#{user.name}\x00#{user.password}")
end
def validate!(reply)
- raise Unauthorized.new(user) if reply.documents[0][Operation::Result::OK] != 1
+ if reply.documents[0][Operation::Result::OK] != 1
+ raise Unauthorized.new(user, MECHANISM)
+ end
@reply = reply
end
end
end
end