Sha256: cc8bb92d5aca857d7ad96e18a3ad7edb20f1feeff8eff9f344b7d283f0d1101f

Contents?: true

Size: 1.22 KB

Versions: 24

Compression:

Stored size: 1.22 KB

Contents

# -*- encoding: utf-8 -*-

#
# Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
#
require "rubygems"
require "stomp"
#
# == SSL Use Case 1 - server does *not* authenticate client, client does *not* authenticate server
#
# Subcase 1.A - Message broker configuration does *not* require client authentication
#
# - Expect connection success
# - Expect a verify result of 20 becuase the client did not authenticate the
#   server's certificate.
#
# Subcase 1.B - Message broker configuration *does* require client authentication
#
# - Expect connection failure (broker must be sent a valid client certificate)
#
class ExampleSSL1
  # Initialize.
  def initialize
  end
  # Run example.
  def run
    ssl_opts = Stomp::SSLParams.new
    hash = { :hosts => [
        {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
      ],
      :reliable => false, # YMMV, to test this in a sane manner
    }
    #
    puts "Connect starts, SSL Use Case 1"
    c = Stomp::Connection.new(hash)
    puts "Connect completed"
    puts "SSL Verify Result: #{ssl_opts.verify_result}"
    # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
    #
    c.disconnect
  end
end
#
e = ExampleSSL1.new
e.run

Version data entries

24 entries across 22 versions & 2 rubygems

Version Path
stomp-1.4.0 examples/ssl_uc1.rb
stomp-1.3.5 examples/ssl_uc1.rb
stomp-1.3.4 examples/ssl_uc1.rb
stomp-1.3.3 examples/ssl_uc1.rb
stomp-1.3.2 examples/ssl_uc1.rb
stomp-1.3.1 examples/ssl_uc1.rb
stomp-1.3.0 examples/ssl_uc1.rb
stomp-1.2.16 examples/ssl_uc1.rb
stomp-1.2.14 examples/ssl_uc1.rb
stomp-1.2.13 examples/ssl_uc1.rb
stomp-1.2.12 examples/ssl_uc1.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/ssl_uc1.rb
stomp-1.2.11 examples/ssl_uc1.rb
stomp-1.2.10 examples/ssl_uc1.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/stomp-1.2.8/examples/ssl_uc1.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/ssl_uc1.rb
stomp-1.2.9 examples/ssl_uc1.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/ssl_uc1.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/stomp-1.2.8/examples/ssl_uc1.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/ssl_uc1.rb