Class: Mongo::Auth::Gssapi::Conversation Private
- Inherits:
-
SaslConversationBase
- Object
- ConversationBase
- SaslConversationBase
- Mongo::Auth::Gssapi::Conversation
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/auth/gssapi/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 behaviour around a single Kerberos conversation between the client and the server.
Constant Summary collapse
- START_MESSAGE =
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 base client first message.
{ saslStart: 1, autoAuthorize: 1 }.freeze
- CONTINUE_MESSAGE =
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 base client continue message.
{ saslContinue: 1 }.freeze
Constants inherited from SaslConversationBase
SaslConversationBase::CLIENT_CONTINUE_MESSAGE, SaslConversationBase::CLIENT_FIRST_MESSAGE
Instance Attribute Summary collapse
-
#authenticator ⇒ Authenticator
readonly
private
Authenticator The native SASL authenticator.
-
#id ⇒ Integer
readonly
private
Get the id of the conversation.
Attributes inherited from ConversationBase
Instance Method Summary collapse
- #client_first_document ⇒ Object private
-
#continue(reply_document, connection) ⇒ Protocol::Message
private
Continue the conversation.
-
#finalize(connection) ⇒ Protocol::Message
private
The next query to execute.
-
#initialize(user, connection, **opts) ⇒ Conversation
constructor
private
Create the new conversation.
- #process_continue_response(reply_document) ⇒ Object private
Methods inherited from SaslConversationBase
Methods inherited from ConversationBase
#build_message, #speculative_auth_document, #validate_external_auth_source
Constructor Details
#initialize(user, connection, **opts) ⇒ Conversation
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.
Create the new conversation.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 44 def initialize(user, connection, **opts) super host = connection.address.host unless defined?(Mongo::GssapiNative) require 'mongo_kerberos' end @authenticator = Mongo::GssapiNative::Authenticator.new( user.name, host, user.auth_mech_properties[:service_name] || 'mongodb', user.auth_mech_properties[:canonicalize_host_name] || false, ) end |
Instance Attribute Details
#authenticator ⇒ Authenticator (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 authenticator The native SASL authenticator.
59 60 61 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 59 def authenticator @authenticator end |
#id ⇒ Integer (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.
Get the id of the conversation.
64 65 66 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 64 def id @id end |
Instance Method Details
#client_first_document ⇒ 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.
66 67 68 69 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 66 def client_first_document start_token = authenticator.initialize_challenge START_MESSAGE.merge(mechanism: Gssapi::MECHANISM, payload: start_token) end |
#continue(reply_document, connection) ⇒ Protocol::Message
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.
Continue the conversation.
77 78 79 80 81 82 83 84 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 77 def continue(reply_document, connection) @id = reply_document['conversationId'] payload = reply_document['payload'] continue_token = authenticator.evaluate_challenge(payload) selector = CONTINUE_MESSAGE.merge(payload: continue_token, conversationId: id) (connection, '$external', selector) end |
#finalize(connection) ⇒ Protocol::Message
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 next query to execute.
93 94 95 96 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 93 def finalize(connection) selector = CONTINUE_MESSAGE.merge(payload: @continue_token, conversationId: id) (connection, '$external', selector) end |
#process_continue_response(reply_document) ⇒ 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.
86 87 88 89 90 |
# File 'build/ruby-driver-v2.19/lib/mongo/auth/gssapi/conversation.rb', line 86 def process_continue_response(reply_document) payload = reply_document['payload'] @continue_token = authenticator.evaluate_challenge(payload) end |