Class: Mongo::Auth::Kerberos::Conversation
- Defined in:
- lib/mongo/auth/kerberos/conversation.rb
Overview
Defines behaviour around a single GSSAPI conversation between the client and server.
Constant Summary collapse
- CONTINUE_MESSAGE =
The base client continue message.
{ saslContinue: 1 }.freeze
- DONE =
The key for the done field in the responses.
'done'.freeze
- ID =
The conversation id field.
'conversationId'.freeze
- PAYLOAD =
The payload field.
'payload'.freeze
- START_MESSAGE =
The base client first message.
{ saslStart: 1, autoAuthorize: 1 }.freeze
Instance Attribute Summary collapse
-
#authenticator ⇒ Authenticator
readonly
Authenticator The native SASL authenticator.
-
#reply ⇒ Protocol::Reply
readonly
Reply The current reply in the conversation.
-
#user ⇒ Mongo::Auth::User
readonly
User The user to authenticate.
Instance Method Summary collapse
-
#finalize(reply) ⇒ Protocol::Query
Finalize the conversation.
-
#id ⇒ Integer
Get the id of the conversation.
-
#initialize(user, host) ⇒ Conversation
constructor
Create the new conversation.
-
#start ⇒ Protocol::Query
Start the authentication conversation.
Constructor Details
#initialize(user, host) ⇒ Conversation
Create the new conversation.
123 124 125 126 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 123 def initialize(user, host) @user = user @authenticator = Authenticator.new(user, host) end |
Instance Attribute Details
#authenticator ⇒ Authenticator (readonly)
Returns authenticator The native SASL authenticator.
60 61 62 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 60 def authenticator @authenticator end |
#reply ⇒ Protocol::Reply (readonly)
Returns reply The current reply in the conversation.
57 58 59 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 57 def reply @reply end |
#user ⇒ Mongo::Auth::User (readonly)
Returns user The user to authenticate.
63 64 65 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 63 def user @user end |
Instance Method Details
#finalize(reply) ⇒ Protocol::Query
Finalize the conversation.
75 76 77 78 79 80 81 82 83 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 75 def finalize(reply) validate!(reply) Protocol::Query.new( Auth::EXTERNAL, Database::COMMAND, CONTINUE_MESSAGE.merge(payload: continue_token, conversationId: id), limit: -1 ) end |
#id ⇒ Integer
Get the id of the conversation.
110 111 112 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 110 def id reply.documents[0][ID] end |
#start ⇒ Protocol::Query
Start the authentication conversation.
93 94 95 96 97 98 99 100 |
# File 'lib/mongo/auth/kerberos/conversation.rb', line 93 def start Protocol::Query.new( Auth::EXTERNAL, Database::COMMAND, START_MESSAGE.merge(mechanism: Kerberos::MECHANISM, payload: start_token), limit: -1 ) end |