Class: Riak::Client::BeefcakeProtobuffsBackend::BeefcakeSocket::TlsInitiator Private

Inherits:
Object
  • Object
show all
Includes:
Util::Translation
Defined in:
lib/riak/client/beefcake/socket.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.

Wrap up the logic to turn a TCP socket into a TLS socket. Depends on Beefcake, which should be relatively safe.

Constant Summary collapse

BC =

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.

::Riak::Client::BeefcakeProtobuffsBackend

Instance Method Summary collapse

Methods included from Util::Translation

#i18n_scope, #t

Constructor Details

#initialize(tcp_socket, host, authentication) ⇒ TlsInitiator

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 a TLS Initiator

Parameters:

  • tcp_socket (TCPSocket)

    the TCPSocket to start TLS on

  • authentication (Hash)

    a hash of authentication details



50
51
52
53
54
# File 'lib/riak/client/beefcake/socket.rb', line 50

def initialize(tcp_socket, host, authentication)
  @sock = @tcp = tcp_socket
  @host = host
  @auth = authentication
end

Instance Method Details

#tls_socketOpenSSL::SSL::SSLSocket

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.

Return the SSLSocket that has a TLS session running. (TLS is a better and safer SSL).

Returns:

  • (OpenSSL::SSL::SSLSocket)


60
61
62
63
64
65
66
67
# File 'lib/riak/client/beefcake/socket.rb', line 60

def tls_socket
  configure_context
  start_tls
  validate_session
  send_authentication
  validate_connection
  return @tls
end