jira-ruby 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 541b1fe24d3e52142ac5d00e028cc7a378e396b7ae4b3fb279959d4d65ceb855
4
- data.tar.gz: 2800df3cd3d0cf68e55ad789872fd6bc261a1134b44a66c796a48c5d018072a3
3
+ metadata.gz: 3167a32cb87f89e17ad016fa13bac784a689c9c39ac800e70137a9944b00b550
4
+ data.tar.gz: 28c6dd444429802a94c58d13a3786647de6bfe37164251fc043761a70ef9d20f
5
5
  SHA512:
6
- metadata.gz: 218b645e82b788254576bb925fa2061a5f023484be5100e67622a0072edd03b6dabda04206ea394a06e630cb918f98bb74d39fc2e99245d64c71cc42b160043d
7
- data.tar.gz: 88d34f8904a0f1954981ca75b2dae6475c2159d373f384b7cba32a2bd7988070cf9b9ba286975882b652d56c5fbab7b36373d8edd5633e6056a903ac54d50838
6
+ metadata.gz: f35ac632b07ffd50c4bc58c810bc10e8ed54ffdd212b9d172e3ce2080ee3e947754e5b9afd521bbc655e69064fd658bb29dda880833afc7327d089c8eea3d31c
7
+ data.tar.gz: 361f3be9096ca1eed2383c4dcd4c388806b6f56e1b44305e802c7bb206a79b1216a4e6c8104ee26472a4f81c59b9b1c533c4d18d140b7e5928e6d3d581e571bc
@@ -36,7 +36,9 @@ module JIRA
36
36
  # :http_debug => false,
37
37
  # :shared_secret => nil,
38
38
  # :cert_path => nil,
39
- # :key_path => nil
39
+ # :key_path => nil,
40
+ # :ssl_client_cert => nil,
41
+ # :ssl_client_key => nil
40
42
  #
41
43
  # See the JIRA::Base class methods for all of the available methods on these accessor
42
44
  # objects.
@@ -86,7 +88,9 @@ module JIRA
86
88
  :base_url,
87
89
  :shared_secret,
88
90
  :cert_path,
89
- :key_path
91
+ :key_path,
92
+ :ssl_client_cert,
93
+ :ssl_client_key
90
94
  ].freeze
91
95
 
92
96
  DEFAULT_OPTIONS = {
@@ -110,10 +114,11 @@ module JIRA
110
114
  raise ArgumentError, "Unknown option(s) given: #{unknown_options}" unless unknown_options.empty?
111
115
 
112
116
  if options[:use_client_cert]
113
- raise ArgumentError, 'Options: :cert_path must be set when :use_client_cert is true' unless @options[:cert_path]
114
- raise ArgumentError, 'Options: :key_path must be set when :use_client_cert is true' unless @options[:key_path]
115
- @options[:cert] = OpenSSL::X509::Certificate.new(File.read(@options[:cert_path]))
116
- @options[:key] = OpenSSL::PKey::RSA.new(File.read(@options[:key_path]))
117
+ @options[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(@options[:cert_path])) if @options[:cert_path]
118
+ @options[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(@options[:key_path])) if @options[:key_path]
119
+
120
+ raise ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true' unless @options[:ssl_client_cert]
121
+ raise ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true' unless @options[:ssl_client_key]
117
122
  end
118
123
 
119
124
  case options[:auth_type]
@@ -53,8 +53,8 @@ module JIRA
53
53
  http_conn = http_class.new(uri.host, uri.port)
54
54
  http_conn.use_ssl = @options[:use_ssl]
55
55
  if @options[:use_client_cert]
56
- http_conn.cert = @options[:cert]
57
- http_conn.key = @options[:key]
56
+ http_conn.cert = @options[:ssl_client_cert]
57
+ http_conn.key = @options[:ssl_client_key]
58
58
  end
59
59
  http_conn.verify_mode = @options[:ssl_verify_mode]
60
60
  http_conn.ssl_version = @options[:ssl_version] if @options[:ssl_version]
@@ -38,6 +38,8 @@ module JIRA
38
38
  @options[:request_token_path] = @options[:context_path] + @options[:request_token_path]
39
39
  @options[:authorize_path] = @options[:context_path] + @options[:authorize_path]
40
40
  @options[:access_token_path] = @options[:context_path] + @options[:access_token_path]
41
+ # proxy_address does not exist in oauth's gem context but proxy does
42
+ @options[:proxy] = @options[:proxy_address] if @options[:proxy_address]
41
43
  OAuth::Consumer.new(@options[:consumer_key], @options[:consumer_secret], @options)
42
44
  end
43
45
 
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = '2.1.2'.freeze
2
+ VERSION = '2.1.3'.freeze
3
3
  end
@@ -59,6 +59,19 @@ RSpec.shared_examples 'Client Common Tests' do
59
59
  expect(subject.Project.find('123')).to eq(find_result)
60
60
  end
61
61
  end
62
+
63
+ describe 'SSL client options' do
64
+ context 'without certificate and key' do
65
+ let(:options) { { use_client_cert: true } }
66
+ subject { JIRA::Client.new(options) }
67
+
68
+ it 'raises an ArgumentError' do
69
+ expect { subject }.to raise_exception(ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true')
70
+ options[:ssl_client_cert] = '<cert></cert>'
71
+ expect { subject }.to raise_exception(ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true')
72
+ end
73
+ end
74
+ end
62
75
  end
63
76
 
64
77
  RSpec.shared_examples 'HttpClient tests' do
@@ -280,8 +280,8 @@ describe JIRA::HttpClient do
280
280
  expect(http_conn).to receive(:use_ssl=).with(basic_client.options[:use_ssl])
281
281
  expect(http_conn).to receive(:verify_mode=).with(basic_client.options[:ssl_verify_mode])
282
282
  expect(http_conn).to receive(:read_timeout=).with(basic_client.options[:read_timeout])
283
- expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[:cert])
284
- expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[:key])
283
+ expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[:ssl_client_cert])
284
+ expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[:ssl_client_key])
285
285
  expect(basic_client_cert_client.http_conn(uri)).to eq(http_conn)
286
286
  end
287
287
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUMO Heavy Industries
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-14 00:00:00.000000000 Z
12
+ date: 2020-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport