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'
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.
37 38 39 40 41 |
# 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 |
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.
45 46 47 |
# File 'lib/mongo/auth/scram.rb', line 45 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.
49 50 51 |
# File 'lib/mongo/auth/scram.rb', line 49 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.
51 52 53 54 55 |
# 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 |
#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.
60 61 62 63 64 65 |
# File 'lib/mongo/auth/scram.rb', line 60 def login converse_multi_step(connection, conversation, speculative_auth_result: speculative_auth_result).tap do raise Error::MissingScramServerSignature unless conversation.server_verified? end end |