Sha256: 9b6f1c4c9b42bb9b93b244d660043b574c1e9c2a5323a89d0b4b4b36965aa92f

Contents?: true

Size: 702 Bytes

Versions: 15

Compression:

Stored size: 702 Bytes

Contents

module Kafka
  module Protocol

    # SaslHandshake Request (Version: 0) => mechanism
    #  mechanism => string

    class SaslHandshakeRequest

      SUPPORTED_MECHANISMS = %w(GSSAPI PLAIN SCRAM-SHA-256 SCRAM-SHA-512)

      def initialize(mechanism)
        unless SUPPORTED_MECHANISMS.include?(mechanism)
          raise Kafka::Error, "Unsupported SASL mechanism #{mechanism}. Supported are #{SUPPORTED_MECHANISMS.join(', ')}"
        end
        @mechanism = mechanism
      end

      def api_key
        SASL_HANDSHAKE_API
      end

      def response_class
        SaslHandshakeResponse
      end

      def encode(encoder)
        encoder.write_string(@mechanism)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby-kafka-0.6.0.beta4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.0.beta3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.0.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.0.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.5 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.4.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.2.beta3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.2.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.2.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.1.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.1.beta1 lib/kafka/protocol/sasl_handshake_request.rb