haveapi 0.18.0 → 0.18.2
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 +4 -4
- data/haveapi.gemspec +1 -1
- data/lib/haveapi/authentication/oauth2/config.rb +10 -1
- data/lib/haveapi/authentication/oauth2/provider.rb +14 -1
- data/lib/haveapi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16eef5420692ea73c7b4969ec61c7efc26c74692c7a9a403d8f664fdf2dafbf8
|
4
|
+
data.tar.gz: 26e5cf981901ca19dc5c0d60c5b567f2cd81e66df2cf70c5333c24b920136554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
|
@@ -190,10 +196,17 @@ module HaveAPI::Authentication
|
|
190
196
|
when :authorization_code
|
191
197
|
authorization = config.find_authorization_by_code(client, req.code)
|
192
198
|
|
193
|
-
if authorization.nil? || authorization.check_code_validity(req.redirect_uri)
|
199
|
+
if authorization.nil? || !authorization.check_code_validity(req.redirect_uri)
|
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(
|
data/lib/haveapi/version.rb
CHANGED
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.
|
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.
|
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.
|
152
|
+
version: 0.18.2
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: mail
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|