Sha256: 6a1159ed31bc3aba06fbdfe7eb3a67d4d3d784c605cbcd21a4257bf44b03a575

Contents?: true

Size: 733 Bytes

Versions: 28

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

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

28 entries across 28 versions & 1 rubygems

Version Path
ruby-kafka-0.7.6.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.5 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.5.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1.debugcorruption2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1.messagecorruptiondebug lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1.possible.pre.fetch.pre.fix lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.1.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.0 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.8 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.0.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.0.beta1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.7.0.alpha4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.7 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.6 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.6.5 lib/kafka/protocol/sasl_handshake_request.rb