ruby-kafka-aws-iam 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4210fcd2155979ae945a9b1c64638b3e2d0b4c63cbd4a6332406e8bfa2f8e26a
4
- data.tar.gz: 48d2ecf50daff8e8b23f77e8fb90c8086686cfdc7a5d65a50645b97ded4676bc
3
+ metadata.gz: 410a10299e8244f0e25ca5d6cea717a54792caa24cf006674d2d2eb45124b646
4
+ data.tar.gz: 97492d2e16908532076a635049bddb7149ec374a282e6c3b13c20000fe0d523f
5
5
  SHA512:
6
- metadata.gz: 650343b839e07b14608e1bcd7b7e893cd6307918f9c9d2894d2f813739e616b56ad2d0ba2a0dbf0986ebaf38ee2dc4848bfc8c2581e1402916148caf3943c83e
7
- data.tar.gz: 3e5d7edfb7fc7867d10df945766c84d38fbf64fd03b84e0fa496cbf523faa8824d8ebc10f258c170667e9482eae3682ee76ebb0aed494de235fd74ce4bea10f0
6
+ metadata.gz: 95e075270ff241afba5b09f03ba18dddcf500022daa56077b2cfeb35a95ed66f69f3db356b7b4bb8a3f77a50bb4c44509d1197d4b936b8418723cce757259d76
7
+ data.tar.gz: 6f2a8046c8b4a77ea3980b5c6b3f88aa7df51a078451b97705defda0c4fcfcc8567407e39817542607ffcec3155c58009a56905550d72d8ec35ceb294b880010
@@ -63,31 +63,31 @@ module Kafka
63
63
 
64
64
  def authentication_payload(host:, time_now:)
65
65
  {
66
- 'version': "2020_10_22",
67
- 'host': host,
68
- 'user-agent': "ruby-kafka",
69
- 'action': "kafka-cluster:Connect",
70
- 'x-amz-algorithm': "AWS4-HMAC-SHA256",
71
- 'x-amz-credential': @access_key_id + "/" + time_now.strftime("%Y%m%d") + "/" + @aws_region + "/kafka-cluster/aws4_request",
72
- 'x-amz-date': time_now.strftime("%Y%m%dT%H%M%SZ"),
73
- 'x-amz-signedheaders': "host",
74
- 'x-amz-expires': "900",
75
- 'x-amz-security-token': @session_token,
76
- 'x-amz-signature': signature(host: host, time_now: time_now)
77
- }.to_json
66
+ 'version' => "2020_10_22",
67
+ 'host' => host,
68
+ 'user-agent' => "ruby-kafka",
69
+ 'action' => "kafka-cluster:Connect",
70
+ 'x-amz-algorithm' => "AWS4-HMAC-SHA256",
71
+ 'x-amz-credential' => @access_key_id + "/" + time_now.strftime("%Y%m%d") + "/" + @aws_region + "/kafka-cluster/aws4_request",
72
+ 'x-amz-date' => time_now.strftime("%Y%m%dT%H%M%SZ"),
73
+ 'x-amz-signedheaders' => "host",
74
+ 'x-amz-expires' => "900",
75
+ 'x-amz-security-token' => @session_token,
76
+ 'x-amz-signature' => signature(host: host, time_now: time_now)
77
+ }.delete_if { |_, v| v.nil? }.to_json
78
78
  end
79
79
 
80
80
  def canonical_request(host:, time_now:)
81
81
  "GET\n" +
82
- "/\n" +
83
- canonical_query_string(time_now: time_now) + "\n" +
84
- canonical_headers(host: host) + "\n" +
85
- signed_headers + "\n" +
86
- hashed_payload
82
+ "/\n" +
83
+ canonical_query_string(time_now: time_now) + "\n" +
84
+ canonical_headers(host: host) + "\n" +
85
+ signed_headers + "\n" +
86
+ hashed_payload
87
87
  end
88
88
 
89
89
  def canonical_query_string(time_now:)
90
- URI.encode_www_form(
90
+ params = {
91
91
  "Action" => "kafka-cluster:Connect",
92
92
  "X-Amz-Algorithm" => "AWS4-HMAC-SHA256",
93
93
  "X-Amz-Credential" => @access_key_id + "/" + time_now.strftime("%Y%m%d") + "/" + @aws_region + "/kafka-cluster/aws4_request",
@@ -95,7 +95,9 @@ module Kafka
95
95
  "X-Amz-Expires" => "900",
96
96
  "X-Amz-Security-Token" => @session_token,
97
97
  "X-Amz-SignedHeaders" => "host"
98
- )
98
+ }.delete_if { |_, v| v.nil? }
99
+
100
+ URI.encode_www_form(params)
99
101
  end
100
102
 
101
103
  def canonical_headers(host:)
@@ -112,9 +114,9 @@ module Kafka
112
114
 
113
115
  def string_to_sign(host:, time_now:)
114
116
  "AWS4-HMAC-SHA256" + "\n" +
115
- time_now.strftime("%Y%m%dT%H%M%SZ") + "\n" +
116
- time_now.strftime("%Y%m%d") + "/" + @aws_region + "/kafka-cluster/aws4_request" + "\n" +
117
- bin_to_hex(digest.digest(canonical_request(host: host, time_now: time_now)))
117
+ time_now.strftime("%Y%m%dT%H%M%SZ") + "\n" +
118
+ time_now.strftime("%Y%m%d") + "/" + @aws_region + "/kafka-cluster/aws4_request" + "\n" +
119
+ bin_to_hex(digest.digest(canonical_request(host: host, time_now: time_now)))
118
120
  end
119
121
 
120
122
  def signature(host:, time_now:)
data/lib/kafka/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kafka
4
- VERSION = "1.4.4"
4
+ VERSION = "1.4.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-kafka-aws-iam
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-10 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: digest-crc