class Mongo::Auth::Scram
Defines behavior for SCRAM authentication.
@api private
Constants
- MECHANISM
-
The authentication mechanism string.
Attributes
@return [ String | nil ] The client nonce used in speculative auth on
the current connection.
@return [ BSON::Document | nil ] The value of speculativeAuthenticate
field of ismaster response of the handshake on the current connection.
Public Class Methods
Source
# File lib/mongo/auth/scram.rb, line 37 def initialize(user, connection, **opts) super @speculative_auth_client_nonce = opts[:speculative_auth_client_nonce] @speculative_auth_result = opts[:speculative_auth_result] end
Initializes the Scram
authenticator.
@param [ Auth::User
] user The user to authenticate. @param [ Mongo::Connection ] connection The connection to authenticate over.
@option opts [ String | nil ] speculative_auth_client_nonce
The client
nonce used in speculative auth on the specified connection that produced the specified speculative auth result.
@option opts [ BSON::Document | nil ] speculative_auth_result
The
value of speculativeAuthenticate field of ismaster response of the handshake on the specified connection.
Calls superclass method
Mongo::Auth::Base::new
Public Instance Methods
Source
# File lib/mongo/auth/scram.rb, line 51 def conversation @conversation ||= self.class.const_get(:Conversation).new( user, connection, client_nonce: speculative_auth_client_nonce) end
Source
# File lib/mongo/auth/scram.rb, line 59 def login converse_multi_step(connection, conversation, speculative_auth_result: speculative_auth_result, ).tap do unless conversation.server_verified? raise Error::MissingScramServerSignature end end end
Log the user in on the current connection.
@return [ BSON::Document ] The document of the authentication response.