Class: Impala::SASLTransport

Inherits:
Thrift::FramedTransport
  • Object
show all
Defined in:
lib/impala/sasl_transport.rb

Constant Summary collapse

STATUS_BYTES =
1
PAYLOAD_LENGTH_BYTES =
4
NEGOTIATION_STATUS =
{
  START:    0x01,
  OK:       0x02,
  BAD:      0x03,
  ERROR:    0x04,
  COMPLETE: 0x05
}

Instance Method Summary collapse

Constructor Details

#initialize(transport, mechanism, options = {}) ⇒ SASLTransport

Returns a new instance of SASLTransport.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/impala/sasl_transport.rb', line 15

def initialize(transport, mechanism, options={})
  super(transport)
  @mechanism = mechanism.to_sym
  @options = options

  unless [:PLAIN, :GSSAPI].include? @mechanism
    raise "Unknown SASL mechanism: #{@mechanism}"
  end

  if @mechanism == :GSSAPI
    @gsscli = GSSAPI::Simple.new(@options[:host], @options[:principal])
  end
end

Instance Method Details

#openObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/impala/sasl_transport.rb', line 29

def open
  super

  case @mechanism
  when :PLAIN
    handshake_plain!
  when :GSSAPI
    handshake_gssapi!
  end
end