Class: Mongo::Auth::Scram Private
- Defined in:
- lib/mongo/auth/scram.rb,
lib/mongo/auth/scram/conversation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defines behavior for SCRAM authentication.
Direct Known Subclasses
Defined Under Namespace
Classes: Conversation
Constant Summary collapse
- MECHANISM =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The authentication mechanism string.
'SCRAM-SHA-1'.freeze
Instance Attribute Summary collapse
-
#speculative_auth_client_nonce ⇒ String | nil
readonly
private
The client nonce used in speculative auth on the current connection.
-
#speculative_auth_result ⇒ BSON::Document | nil
readonly
private
The value of speculativeAuthenticate field of hello response of the handshake on the current connection.
Attributes inherited from Base
Instance Method Summary collapse
- #conversation ⇒ Object private
-
#initialize(user, connection, **opts) ⇒ Scram
constructor
private
Initializes the Scram authenticator.
-
#login ⇒ BSON::Document
private
Log the user in on the current connection.
Constructor Details
#initialize(user, connection, **opts) ⇒ Scram
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the Scram authenticator.
40 41 42 43 44 |
# File 'lib/mongo/auth/scram.rb', line 40 def initialize(user, connection, **opts) super @speculative_auth_client_nonce = opts[:speculative_auth_client_nonce] @speculative_auth_result = opts[:speculative_auth_result] end |
Instance Attribute Details
#speculative_auth_client_nonce ⇒ String | nil (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The client nonce used in speculative auth on the current connection.
48 49 50 |
# File 'lib/mongo/auth/scram.rb', line 48 def speculative_auth_client_nonce @speculative_auth_client_nonce end |
#speculative_auth_result ⇒ BSON::Document | nil (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The value of speculativeAuthenticate field of hello response of the handshake on the current connection.
52 53 54 |
# File 'lib/mongo/auth/scram.rb', line 52 def speculative_auth_result @speculative_auth_result end |
Instance Method Details
#conversation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 57 |
# File 'lib/mongo/auth/scram.rb', line 54 def conversation @conversation ||= self.class.const_get(:Conversation).new( user, connection, client_nonce: speculative_auth_client_nonce) end |
#login ⇒ BSON::Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Log the user in on the current connection.
62 63 64 65 66 67 68 69 70 |
# File 'lib/mongo/auth/scram.rb', line 62 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 |