Class: Mongo::Auth::X509 Private

Inherits:
Base
  • Object
show all
Defined in:
build/ruby-driver-master/lib/mongo/auth/x509.rb,
build/ruby-driver-master/lib/mongo/auth/x509/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 X.509 authentication.

Since:

  • 2.0.0

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.

Since:

  • 2.0.0

'MONGODB-X509'.freeze

Instance Attribute Summary

Attributes inherited from Base

#connection, #user

Instance Method Summary collapse

Methods inherited from Base

#conversation

Constructor Details

#initialize(user, connection, **opts) ⇒ X509

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 X.509 authenticator.

Parameters:

  • user (Auth::User)

    The user to authenticate.

  • connection (Mongo::Connection)

    The connection to authenticate over.

Since:

  • 2.0.0



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'build/ruby-driver-master/lib/mongo/auth/x509.rb', line 36

def initialize(user, connection, **opts)
  # The only valid database for X.509 authentication is $external.
  if user.auth_source != '$external'
    user_name_msg = if user.name
      " #{user.name}"
    else
      ''
    end
    raise Auth::InvalidConfiguration, "User#{user_name_msg} specifies auth source '#{user.auth_source}', but the only valid auth source for X.509 is '$external'"
  end

  super
end

Instance Method Details

#loginBSON::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.

Returns:

  • (BSON::Document)

    The document of the authentication response.

Since:

  • 2.0.0



53
54
55
# File 'build/ruby-driver-master/lib/mongo/auth/x509.rb', line 53

def 
  converse_1_step(connection, conversation)
end