Class: Mongo::Auth::X509

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo/auth/x509.rb,
lib/mongo/auth/x509/conversation.rb

Overview

Defines behaviour for x.509 authentication.

Since:

  • 2.0.0

Defined Under Namespace

Classes: Conversation

Constant Summary

MECHANISM =

The authentication mechinism string.

Since:

  • 2.0.0

'MONGODB-X509'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ X509

Instantiate a new authenticator.

Examples:

Create the authenticator.

Mongo::Auth::X509.new(user)

Parameters:

Since:

  • 2.0.0



41
42
43
# File 'lib/mongo/auth/x509.rb', line 41

def initialize(user)
  @user = user
end

Instance Attribute Details

#userMongo::Auth::User (readonly)

Returns The user to authenticate.

Returns:

Since:

  • 2.0.0



31
32
33
# File 'lib/mongo/auth/x509.rb', line 31

def user
  @user
end

Instance Method Details

#login(connection) ⇒ Protocol::Reply

Log the user in on the given connection.

Examples:

Log the user in.

user.(connection)

Parameters:

  • connection (Mongo::Connection)

    The connection to log into. on.

Returns:

Since:

  • 2.0.0



56
57
58
59
# File 'lib/mongo/auth/x509.rb', line 56

def (connection)
  conversation = Conversation.new(user)
  conversation.finalize(connection.dispatch([ conversation.start ]))
end