Class: Mongo::Auth::LDAP::Conversation
- Inherits:
-
Object
- Object
- Mongo::Auth::LDAP::Conversation
- Defined in:
- lib/mongo/auth/ldap/conversation.rb
Overview
Defines behaviour around a single PLAIN conversation between the client and server.
Constant Summary collapse
- LOGIN =
The login message.
{ saslStart: 1, autoAuthorize: 1 }.freeze
Instance Attribute Summary collapse
-
#reply ⇒ Protocol::Reply
readonly
Reply The current reply in the conversation.
-
#user ⇒ User
readonly
User The user for the conversation.
Instance Method Summary collapse
-
#finalize(reply) ⇒ Protocol::Query
Finalize the PLAIN conversation.
-
#initialize(user) ⇒ Conversation
constructor
Create the new conversation.
-
#start ⇒ Protocol::Query
Start the PLAIN conversation.
Constructor Details
#initialize(user) ⇒ Conversation
Create the new conversation.
79 80 81 |
# File 'lib/mongo/auth/ldap/conversation.rb', line 79 def initialize(user) @user = user end |
Instance Attribute Details
#reply ⇒ Protocol::Reply (readonly)
Returns reply The current reply in the conversation.
32 33 34 |
# File 'lib/mongo/auth/ldap/conversation.rb', line 32 def reply @reply end |
#user ⇒ User (readonly)
Returns user The user for the conversation.
35 36 37 |
# File 'lib/mongo/auth/ldap/conversation.rb', line 35 def user @user end |
Instance Method Details
#finalize(reply) ⇒ Protocol::Query
Finalize the PLAIN conversation. This is meant to be iterated until the provided reply indicates the conversation is finished.
49 50 51 |
# File 'lib/mongo/auth/ldap/conversation.rb', line 49 def finalize(reply) validate!(reply) end |
#start ⇒ Protocol::Query
Start the PLAIN conversation. This returns the first message that needs to be send to the server.
62 63 64 65 66 67 68 69 |
# File 'lib/mongo/auth/ldap/conversation.rb', line 62 def start Protocol::Query.new( Auth::EXTERNAL, Database::COMMAND, LOGIN.merge(payload: payload, mechanism: LDAP::MECHANISM), limit: -1 ) end |