haveapi 0.18.1 → 0.18.2

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: 7a503deac250571b471c672f113a2470e24ebf575ec19b09d44d1d48c210bf50
4
- data.tar.gz: 300d414e67b3d2083c0c6d352e1817274e7ed729d099b6f814aa5fd03bd81ce8
3
+ metadata.gz: 16eef5420692ea73c7b4969ec61c7efc26c74692c7a9a403d8f664fdf2dafbf8
4
+ data.tar.gz: 26e5cf981901ca19dc5c0d60c5b567f2cd81e66df2cf70c5333c24b920136554
5
5
  SHA512:
6
- metadata.gz: 3e7d0ecf8a43a49e8bf7dca76286f6dc43cb22c65794d080e2d74b7f5ba1e39ccb6d1d1800229f925b26df6dcbad8f8bb5eb74ac70c50741450c95a5ad9f893d
7
- data.tar.gz: 10581d63837d9a8a2fb19625dc8b61b1217fe0c4fe55dac6376190e45e482d5786ca0b32cc7d5bcd6c100f16871a5f27c789bfcdd5ea4edc5c63cadec5ad03bb
6
+ metadata.gz: '0876a3b9b10ad452c89a62e06fc56e29cfb6aff188e4943274adf4e4180464b90daa420e4ab0953faba1f1ae9a5df0a8a19ae0362acd7290043efefd050f8b19'
7
+ data.tar.gz: cddc8f6c09dea69afc3a359ab18cd947a5a338ec9413d2f16eb600fa4893c88f0cbe3e3224b9ae58ac0d3de5707b96ec0e0891162d3d0ee9c97e906bff0c8e44
data/haveapi.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'rake'
24
24
  s.add_runtime_dependency 'github-markdown'
25
25
  s.add_runtime_dependency 'nesty', '~> 1.0'
26
- s.add_runtime_dependency 'haveapi-client', '~> 0.18.1'
26
+ s.add_runtime_dependency 'haveapi-client', '~> 0.18.2'
27
27
  s.add_runtime_dependency 'mail'
28
28
  s.add_runtime_dependency 'rack-oauth2', '~> 2.2.0'
29
29
  end
@@ -130,13 +130,22 @@ module HaveAPI::Authentication
130
130
  #
131
131
  # @return [Hash<String, String>]
132
132
  def oauth2_params(req)
133
- {
133
+ ret = {
134
134
  client_id: req.client_id,
135
135
  response_type: req.response_type,
136
136
  redirect_uri: req.redirect_uri,
137
137
  scope: req.scope.join(' '),
138
138
  state: req.state,
139
139
  }
140
+
141
+ if req.code_challenge.present? && req.code_challenge_method.present?
142
+ ret.update(
143
+ code_challenge: req.code_challenge,
144
+ code_challenge_method: req.code_challenge_method,
145
+ )
146
+ end
147
+
148
+ ret
140
149
  end
141
150
  end
142
151
  end
@@ -35,6 +35,12 @@ module HaveAPI::Authentication
35
35
 
36
36
  # Abstract class describing ongoing authorization and what methods it must respond to
37
37
  class Authorization
38
+ # @return [String, nil]
39
+ attr_reader :code_challenge
40
+
41
+ # @return [String, nil]
42
+ attr_reader :code_challenge_method
43
+
38
44
  # @return [String]
39
45
  attr_reader :redirect_uri
40
46
 
@@ -194,6 +200,13 @@ module HaveAPI::Authentication
194
200
  req.invalid_grant!
195
201
  end
196
202
 
203
+ if authorization.code_challenge && authorization.code_challenge_method
204
+ req.verify_code_verifier!(
205
+ authorization.code_challenge,
206
+ authorization.code_challenge_method.to_sym,
207
+ )
208
+ end
209
+
197
210
  access_token, expires_at, refresh_token = config.get_tokens(authorization, handler.request)
198
211
 
199
212
  bearer_token = Rack::OAuth2::AccessToken::Bearer.new(
@@ -1,4 +1,4 @@
1
1
  module HaveAPI
2
2
  PROTOCOL_VERSION = '2.0'
3
- VERSION = '0.18.1'
3
+ VERSION = '0.18.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haveapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.18.1
145
+ version: 0.18.2
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.18.1
152
+ version: 0.18.2
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mail
155
155
  requirement: !ruby/object:Gem::Requirement