oauth2 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +2 -2
- data/lib/oauth2/access_token.rb +4 -2
- data/lib/oauth2/authenticator.rb +3 -1
- data/lib/oauth2/client.rb +87 -49
- data/lib/oauth2/error.rb +2 -0
- data/lib/oauth2/mac_token.rb +2 -0
- data/lib/oauth2/response.rb +2 -0
- data/lib/oauth2/strategy/assertion.rb +3 -1
- data/lib/oauth2/strategy/auth_code.rb +3 -1
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +3 -1
- data/lib/oauth2/strategy/implicit.rb +3 -1
- data/lib/oauth2/strategy/password.rb +3 -1
- data/lib/oauth2/version.rb +1 -1
- data/lib/oauth2.rb +2 -0
- data/spec/fixtures/README.md +11 -0
- data/spec/fixtures/RS256/jwtRS256.key +51 -0
- data/spec/fixtures/RS256/jwtRS256.key.pub +14 -0
- data/spec/helper.rb +6 -3
- data/spec/oauth2/access_token_spec.rb +3 -1
- data/spec/oauth2/authenticator_spec.rb +2 -0
- data/spec/oauth2/client_spec.rb +31 -5
- data/spec/oauth2/mac_token_spec.rb +2 -0
- data/spec/oauth2/response_spec.rb +6 -0
- data/spec/oauth2/strategy/assertion_spec.rb +70 -16
- data/spec/oauth2/strategy/auth_code_spec.rb +1 -0
- data/spec/oauth2/strategy/base_spec.rb +2 -0
- data/spec/oauth2/strategy/client_credentials_spec.rb +2 -0
- data/spec/oauth2/strategy/implicit_spec.rb +2 -0
- data/spec/oauth2/strategy/password_spec.rb +2 -0
- metadata +18 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc51b3695e669f4853934aa43c64de29380877340685e35e44ccc1be8957226
|
4
|
+
data.tar.gz: aa8e0e388084a5374743b1fc7122fd85729f41876fdbe9d679a441813cb3e10c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06c89fbcf461bc08dce02c484b7fef1284d31bed026c606bf966fe85ca351451063763e9c580e9f716bd7a811e0dd8d2f0b3572df5190724dcaf0c539fd9d4aa
|
7
|
+
data.tar.gz: cf59ec61aa6d7e7c595ff2b5ea73a24441364300ba846efb52508907568ed5aa62619b69dec6428bbfbd341540a4d802709b03703e431fc83ed1de9634d10523
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
## unreleased
|
5
5
|
|
6
|
+
## [1.4.9] - 2022-02-20
|
7
|
+
|
8
|
+
- Fixes compatibility with Faraday v2 [572](https://github.com/oauth-xx/oauth2/issues/572)
|
9
|
+
- Includes supported versions of Faraday in test matrix:
|
10
|
+
- Faraday ~> 2.2.0 with Ruby >= 2.6
|
11
|
+
- Faraday ~> 1.10 with Ruby >= 2.4
|
12
|
+
- Faraday ~> 0.17.3 with Ruby >= 1.9
|
13
|
+
- Add Windows and MacOS to test matrix
|
14
|
+
|
6
15
|
## [1.4.8] - 2022-02-18
|
7
16
|
|
8
17
|
- MFA is now required to push new gem versions (@pboling)
|
data/README.md
CHANGED
@@ -39,8 +39,8 @@ branch which for version 1.4.x releases. Version 2.0 is coming! ⚠️
|
|
39
39
|
| Version | Release Date | Readme |
|
40
40
|
|---------|--------------|----------------------------------------------------------|
|
41
41
|
| 1.4.8 | Feb 18, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.8/README.md |
|
42
|
-
| 1.4.7 | Mar
|
43
|
-
| 1.4.6 | Mar
|
42
|
+
| 1.4.7 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
|
43
|
+
| 1.4.6 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
|
44
44
|
| 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
|
45
45
|
| 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
|
46
46
|
| 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
|
data/lib/oauth2/access_token.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
class AccessToken
|
3
5
|
attr_reader :client, :token, :expires_in, :expires_at, :params
|
@@ -38,7 +40,7 @@ module OAuth2
|
|
38
40
|
# @option opts [String] :header_format ('Bearer %s') the string format to use for the Authorization header
|
39
41
|
# @option opts [String] :param_name ('access_token') the parameter name to use for transmission of the
|
40
42
|
# Access Token value in :body or :query transmission mode
|
41
|
-
def initialize(client, token, opts = {})
|
43
|
+
def initialize(client, token, opts = {})
|
42
44
|
@client = client
|
43
45
|
@token = token.to_s
|
44
46
|
opts = opts.dup
|
@@ -151,7 +153,7 @@ module OAuth2
|
|
151
153
|
|
152
154
|
private
|
153
155
|
|
154
|
-
def configure_authentication!(opts)
|
156
|
+
def configure_authentication!(opts)
|
155
157
|
case options[:mode]
|
156
158
|
when :header
|
157
159
|
opts[:headers] ||= {}
|
data/lib/oauth2/authenticator.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'base64'
|
2
4
|
|
3
5
|
module OAuth2
|
@@ -60,7 +62,7 @@ module OAuth2
|
|
60
62
|
params.merge(:headers => headers)
|
61
63
|
end
|
62
64
|
|
63
|
-
# @see https://
|
65
|
+
# @see https://datatracker.ietf.org/doc/html/rfc2617#section-2
|
64
66
|
def basic_auth_header
|
65
67
|
{'Authorization' => self.class.encode_basic_auth(id, secret)}
|
66
68
|
end
|
data/lib/oauth2/client.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'logger'
|
3
5
|
|
4
6
|
module OAuth2
|
7
|
+
ConnectionError = Class.new(Faraday::ConnectionFailed)
|
5
8
|
# The OAuth2::Client class
|
6
9
|
class Client # rubocop:disable Metrics/ClassLength
|
7
10
|
RESERVED_PARAM_KEYS = %w[headers parse].freeze
|
@@ -16,17 +19,18 @@ module OAuth2
|
|
16
19
|
#
|
17
20
|
# @param [String] client_id the client_id value
|
18
21
|
# @param [String] client_secret the client_secret value
|
19
|
-
# @param [Hash]
|
20
|
-
# @option
|
21
|
-
# @option
|
22
|
-
# @option
|
23
|
-
# @option
|
24
|
-
# @option
|
25
|
-
# @option
|
26
|
-
# @option
|
27
|
-
# @option
|
28
|
-
# @option
|
29
|
-
# @option
|
22
|
+
# @param [Hash] options the options to create the client with
|
23
|
+
# @option options [String] :site the OAuth2 provider site host
|
24
|
+
# @option options [String] :redirect_uri the absolute URI to the Redirection Endpoint for use in authorization grants and token exchange
|
25
|
+
# @option options [String] :authorize_url ('oauth/authorize') absolute or relative URL path to the Authorization endpoint
|
26
|
+
# @option options [String] :token_url ('oauth/token') absolute or relative URL path to the Token endpoint
|
27
|
+
# @option options [Symbol] :token_method (:post) HTTP method to use to request token (:get or :post)
|
28
|
+
# @option options [Symbol] :auth_scheme (:basic_auth) HTTP method to use to authorize request (:basic_auth or :request_body)
|
29
|
+
# @option options [Hash] :connection_opts ({}) Hash of connection options to pass to initialize Faraday with
|
30
|
+
# @option options [FixNum] :max_redirects (5) maximum number of redirects to follow
|
31
|
+
# @option options [Boolean] :raise_errors (true) whether or not to raise an OAuth2::Error on responses with 400+ status codes
|
32
|
+
# @option options [Logger] :logger (::Logger.new($stdout)) which logger to use when OAUTH_DEBUG is enabled
|
33
|
+
# @option options [Proc] (DEPRECATED) :extract_access_token proc that extracts the access token from the response
|
30
34
|
# @yield [builder] The Faraday connection builder
|
31
35
|
def initialize(client_id, client_secret, options = {}, &block)
|
32
36
|
opts = options.dup
|
@@ -34,24 +38,22 @@ module OAuth2
|
|
34
38
|
@secret = client_secret
|
35
39
|
@site = opts.delete(:site)
|
36
40
|
ssl = opts.delete(:ssl)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
:extract_access_token => DEFAULT_EXTRACT_ACCESS_TOKEN,
|
48
|
-
}.merge(opts)
|
41
|
+
@options = {:authorize_url => 'oauth/authorize',
|
42
|
+
:token_url => 'oauth/token',
|
43
|
+
:token_method => :post,
|
44
|
+
:auth_scheme => :request_body,
|
45
|
+
:connection_opts => {},
|
46
|
+
:connection_build => block,
|
47
|
+
:max_redirects => 5,
|
48
|
+
:raise_errors => true,
|
49
|
+
:extract_access_token => DEFAULT_EXTRACT_ACCESS_TOKEN, # DEPRECATED
|
50
|
+
:logger => ::Logger.new($stdout)}.merge(opts)
|
49
51
|
@options[:connection_opts][:ssl] = ssl if ssl
|
50
52
|
end
|
51
53
|
|
52
54
|
# Set the site host
|
53
55
|
#
|
54
|
-
# @param [String] the OAuth2 provider site host
|
56
|
+
# @param value [String] the OAuth2 provider site host
|
55
57
|
def site=(value)
|
56
58
|
@connection = nil
|
57
59
|
@site = value
|
@@ -61,8 +63,12 @@ module OAuth2
|
|
61
63
|
def connection
|
62
64
|
@connection ||=
|
63
65
|
Faraday.new(site, options[:connection_opts]) do |builder|
|
66
|
+
oauth_debug_logging(builder)
|
64
67
|
if options[:connection_build]
|
65
68
|
options[:connection_build].call(builder)
|
69
|
+
else
|
70
|
+
builder.request :url_encoded # form-encode POST params
|
71
|
+
builder.adapter Faraday.default_adapter # make requests with Net::HTTP
|
66
72
|
end
|
67
73
|
end
|
68
74
|
end
|
@@ -94,15 +100,18 @@ module OAuth2
|
|
94
100
|
# code response for this request. Will default to client option
|
95
101
|
# @option opts [Symbol] :parse @see Response::initialize
|
96
102
|
# @yield [req] The Faraday request
|
97
|
-
def request(verb, url, opts = {}) # rubocop:disable Metrics/
|
98
|
-
connection.response :logger, ::Logger.new($stdout) if ENV['OAUTH_DEBUG'] == 'true'
|
99
|
-
|
103
|
+
def request(verb, url, opts = {}) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize
|
100
104
|
url = connection.build_url(url).to_s
|
101
105
|
|
102
|
-
|
103
|
-
|
104
|
-
|
106
|
+
begin
|
107
|
+
response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
|
108
|
+
req.params.update(opts[:params]) if opts[:params]
|
109
|
+
yield(req) if block_given?
|
110
|
+
end
|
111
|
+
rescue Faraday::ConnectionFailed => e
|
112
|
+
raise ConnectionError, e
|
105
113
|
end
|
114
|
+
|
106
115
|
response = Response.new(response, :parse => opts[:parse])
|
107
116
|
|
108
117
|
case response.status
|
@@ -115,7 +124,13 @@ module OAuth2
|
|
115
124
|
verb = :get
|
116
125
|
opts.delete(:body)
|
117
126
|
end
|
118
|
-
|
127
|
+
location = response.headers['location']
|
128
|
+
if location
|
129
|
+
request(verb, location, opts)
|
130
|
+
else
|
131
|
+
error = Error.new(response)
|
132
|
+
raise(error, "Got #{response.status} status code, but no Location header was present")
|
133
|
+
end
|
119
134
|
when 200..299, 300..399
|
120
135
|
# on non-redirecting 3xx statuses, just return the response
|
121
136
|
response
|
@@ -133,11 +148,11 @@ module OAuth2
|
|
133
148
|
|
134
149
|
# Initializes an AccessToken by making a request to the token endpoint
|
135
150
|
#
|
136
|
-
# @param [Hash]
|
137
|
-
# @param [Hash] access token options, to pass to the AccessToken object
|
138
|
-
# @param [Class] class of access token for easier subclassing OAuth2::AccessToken
|
151
|
+
# @param params [Hash] a Hash of params for the token endpoint
|
152
|
+
# @param access_token_opts [Hash] access token options, to pass to the AccessToken object
|
153
|
+
# @param access_token_class [Class] class of access token for easier subclassing OAuth2::AccessToken
|
139
154
|
# @return [AccessToken] the initialized AccessToken
|
140
|
-
def get_token(params, access_token_opts = {}, extract_access_token = options[:extract_access_token]) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
155
|
+
def get_token(params, access_token_opts = {}, extract_access_token = options[:extract_access_token]) # # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity Metrics/AbcSize, Metrics/MethodLength
|
141
156
|
params = params.map do |key, value|
|
142
157
|
if RESERVED_PARAM_KEYS.include?(key)
|
143
158
|
[key.to_sym, value]
|
@@ -147,7 +162,7 @@ module OAuth2
|
|
147
162
|
end
|
148
163
|
params = Hash[params]
|
149
164
|
|
150
|
-
params =
|
165
|
+
params = authenticator.apply(params)
|
151
166
|
opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
|
152
167
|
headers = params.delete(:headers) || {}
|
153
168
|
if options[:token_method] == :post
|
@@ -157,8 +172,9 @@ module OAuth2
|
|
157
172
|
opts[:params] = params
|
158
173
|
opts[:headers] = {}
|
159
174
|
end
|
160
|
-
opts[:headers].merge
|
161
|
-
|
175
|
+
opts[:headers] = opts[:headers].merge(headers)
|
176
|
+
http_method = options[:token_method]
|
177
|
+
response = request(http_method, token_url, opts)
|
162
178
|
|
163
179
|
access_token = begin
|
164
180
|
build_access_token(response, access_token_opts, extract_access_token)
|
@@ -166,37 +182,45 @@ module OAuth2
|
|
166
182
|
nil
|
167
183
|
end
|
168
184
|
|
169
|
-
|
185
|
+
response_contains_token = access_token || (
|
186
|
+
response.parsed.is_a?(Hash) &&
|
187
|
+
(response.parsed['access_token'] || response.parsed['id_token'])
|
188
|
+
)
|
189
|
+
|
190
|
+
if options[:raise_errors] && !response_contains_token
|
170
191
|
error = Error.new(response)
|
171
192
|
raise(error)
|
193
|
+
elsif !response_contains_token
|
194
|
+
return nil
|
172
195
|
end
|
196
|
+
|
173
197
|
access_token
|
174
198
|
end
|
175
199
|
|
176
200
|
# The Authorization Code strategy
|
177
201
|
#
|
178
|
-
# @see http://
|
202
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.1
|
179
203
|
def auth_code
|
180
204
|
@auth_code ||= OAuth2::Strategy::AuthCode.new(self)
|
181
205
|
end
|
182
206
|
|
183
207
|
# The Implicit strategy
|
184
208
|
#
|
185
|
-
# @see http://
|
209
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-26#section-4.2
|
186
210
|
def implicit
|
187
211
|
@implicit ||= OAuth2::Strategy::Implicit.new(self)
|
188
212
|
end
|
189
213
|
|
190
214
|
# The Resource Owner Password Credentials strategy
|
191
215
|
#
|
192
|
-
# @see http://
|
216
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.3
|
193
217
|
def password
|
194
218
|
@password ||= OAuth2::Strategy::Password.new(self)
|
195
219
|
end
|
196
220
|
|
197
221
|
# The Client Credentials strategy
|
198
222
|
#
|
199
|
-
# @see http://
|
223
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.4
|
200
224
|
def client_credentials
|
201
225
|
@client_credentials ||= OAuth2::Strategy::ClientCredentials.new(self)
|
202
226
|
end
|
@@ -216,10 +240,10 @@ module OAuth2
|
|
216
240
|
#
|
217
241
|
# @api semipublic
|
218
242
|
#
|
219
|
-
# @see https://
|
220
|
-
# @see https://
|
221
|
-
# @see https://
|
222
|
-
# @see https://
|
243
|
+
# @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1
|
244
|
+
# @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3
|
245
|
+
# @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.1
|
246
|
+
# @see https://datatracker.ietf.org/doc/html/rfc6749#section-10.6
|
223
247
|
# @return [Hash] the params to add to a request or URL
|
224
248
|
def redirection_params
|
225
249
|
if options[:redirect_uri]
|
@@ -236,19 +260,33 @@ module OAuth2
|
|
236
260
|
|
237
261
|
private
|
238
262
|
|
263
|
+
# Returns the authenticator object
|
264
|
+
#
|
265
|
+
# @return [Authenticator] the initialized Authenticator
|
266
|
+
def authenticator
|
267
|
+
Authenticator.new(id, secret, options[:auth_scheme])
|
268
|
+
end
|
269
|
+
|
270
|
+
# Builds the access token from the response of the HTTP call
|
271
|
+
#
|
272
|
+
# @return [AccessToken] the initialized AccessToken
|
239
273
|
def build_access_token(response, access_token_opts, extract_access_token)
|
240
274
|
parsed_response = response.parsed.dup
|
241
275
|
return unless parsed_response.is_a?(Hash)
|
242
276
|
|
243
277
|
hash = parsed_response.merge(access_token_opts)
|
244
278
|
|
245
|
-
# Provide backwards compatibility for old
|
246
|
-
#
|
279
|
+
# Provide backwards compatibility for old AccessToken.form_hash pattern
|
280
|
+
# Will be deprecated in 2.x
|
247
281
|
if extract_access_token.is_a?(Class) && extract_access_token.respond_to?(:from_hash)
|
248
282
|
extract_access_token.from_hash(self, hash)
|
249
283
|
else
|
250
284
|
extract_access_token.call(self, hash)
|
251
285
|
end
|
252
286
|
end
|
287
|
+
|
288
|
+
def oauth_debug_logging(builder)
|
289
|
+
builder.response :logger, options[:logger], :bodies => true if ENV['OAUTH_DEBUG'] == 'true'
|
290
|
+
end
|
253
291
|
end
|
254
292
|
end
|
data/lib/oauth2/error.rb
CHANGED
data/lib/oauth2/mac_token.rb
CHANGED
data/lib/oauth2/response.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'jwt'
|
2
4
|
|
3
5
|
module OAuth2
|
4
6
|
module Strategy
|
5
7
|
# The Client Assertion Strategy
|
6
8
|
#
|
7
|
-
# @see
|
9
|
+
# @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-10#section-4.1.3
|
8
10
|
#
|
9
11
|
# Sample usage:
|
10
12
|
# client = OAuth2::Client.new(client_id, client_secret,
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
module Strategy
|
3
5
|
# The Authorization Code Strategy
|
4
6
|
#
|
5
|
-
# @see http://
|
7
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.1
|
6
8
|
class AuthCode < Base
|
7
9
|
# The required query parameters for the authorize URL
|
8
10
|
#
|
data/lib/oauth2/strategy/base.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
module Strategy
|
3
5
|
# The Client Credentials Strategy
|
4
6
|
#
|
5
|
-
# @see http://
|
7
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.4
|
6
8
|
class ClientCredentials < Base
|
7
9
|
# Not used for this strategy
|
8
10
|
#
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
module Strategy
|
3
5
|
# The Implicit Strategy
|
4
6
|
#
|
5
|
-
# @see http://
|
7
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-26#section-4.2
|
6
8
|
class Implicit < Base
|
7
9
|
# The required query parameters for the authorize URL
|
8
10
|
#
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
module Strategy
|
3
5
|
# The Resource Owner Password Credentials Authorization Strategy
|
4
6
|
#
|
5
|
-
# @see http://
|
7
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.3
|
6
8
|
class Password < Base
|
7
9
|
# Not used for this strategy
|
8
10
|
#
|
data/lib/oauth2/version.rb
CHANGED
data/lib/oauth2.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# RS256
|
2
|
+
|
3
|
+
## How keys were made
|
4
|
+
|
5
|
+
```shell
|
6
|
+
# No passphrase
|
7
|
+
# Generates the public and private keys:
|
8
|
+
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
|
9
|
+
# Converts the key to PEM format
|
10
|
+
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
|
11
|
+
```
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0u7gk+Q7
|
10
|
+
FUH1UgW3kmJDTG0XaxQxYTBSIO7mcmyjDyBgKVuQmt5E1ycFeteOVdPD/CG/fPYh
|
11
|
+
thvc4UytEFwsMdNy3iD6/wuUH68tAKam28UZaOb0qK+00cQQD8fulY9rKtSL10Lv
|
12
|
+
JFWUOa/SJyLvk9vUmfvFn182il1nX6GpyxyMmE/FCnH4CT/DjrSZf08mOO8eL5of
|
13
|
+
YHMK/oiXr1eODqx+pOwClNsCAwEAAQ==
|
14
|
+
-----END PUBLIC KEY-----
|
data/spec/helper.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
DEBUG = ENV['DEBUG'] == 'true'
|
4
|
+
RUN_COVERAGE = ENV['CI_CODECOV'] || ENV['CI'].nil?
|
2
5
|
|
3
6
|
ruby_version = Gem::Version.new(RUBY_VERSION)
|
4
7
|
minimum_version = ->(version) { ruby_version >= Gem::Version.new(version) && RUBY_ENGINE == 'ruby' }
|
5
|
-
coverage = minimum_version.call('2.7')
|
6
|
-
debug = minimum_version.call('2.5')
|
8
|
+
coverage = minimum_version.call('2.7') && RUN_COVERAGE
|
9
|
+
debug = minimum_version.call('2.5') && DEBUG
|
7
10
|
|
8
11
|
require 'simplecov' if coverage
|
9
|
-
require 'byebug' if
|
12
|
+
require 'byebug' if debug
|
10
13
|
|
11
14
|
require 'oauth2'
|
12
15
|
require 'addressable/uri'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
describe OAuth2::AccessToken do
|
2
4
|
subject { described_class.new(client, token) }
|
3
5
|
|
@@ -30,7 +32,7 @@ describe OAuth2::AccessToken do
|
|
30
32
|
expect(target.params['foo']).to eq('bar')
|
31
33
|
end
|
32
34
|
|
33
|
-
def assert_initialized_token(target)
|
35
|
+
def assert_initialized_token(target)
|
34
36
|
expect(target.token).to eq(token)
|
35
37
|
expect(target).to be_expires
|
36
38
|
expect(target.params.keys).to include('foo')
|
data/spec/oauth2/client_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require 'helper'
|
4
4
|
require 'nkf'
|
5
5
|
|
6
6
|
describe OAuth2::Client do
|
7
7
|
subject do
|
8
|
-
described_class.new('abc', 'def', :site => 'https://api.example.com') do |builder|
|
8
|
+
described_class.new('abc', 'def', {:site => 'https://api.example.com'}.merge(options)) do |builder|
|
9
9
|
builder.adapter :test do |stub|
|
10
10
|
stub.get('/success') { |env| [200, {'Content-Type' => 'text/awesome'}, 'yay'] }
|
11
11
|
stub.get('/reflect') { |env| [200, {}, env[:body]] }
|
@@ -13,6 +13,7 @@ describe OAuth2::Client do
|
|
13
13
|
stub.get('/unauthorized') { |env| [401, {'Content-Type' => 'application/json'}, MultiJson.encode(:error => error_value, :error_description => error_description_value)] }
|
14
14
|
stub.get('/conflict') { |env| [409, {'Content-Type' => 'text/plain'}, 'not authorized'] }
|
15
15
|
stub.get('/redirect') { |env| [302, {'Content-Type' => 'text/plain', 'location' => '/success'}, ''] }
|
16
|
+
stub.get('/redirect_no_loc') { |_env| [302, {'Content-Type' => 'text/plain'}, ''] }
|
16
17
|
stub.post('/redirect') { |env| [303, {'Content-Type' => 'text/plain', 'location' => '/reflect'}, ''] }
|
17
18
|
stub.get('/error') { |env| [500, {'Content-Type' => 'text/plain'}, 'unknown error'] }
|
18
19
|
stub.get('/empty_get') { |env| [204, {}, nil] }
|
@@ -24,6 +25,7 @@ describe OAuth2::Client do
|
|
24
25
|
|
25
26
|
let!(:error_value) { 'invalid_token' }
|
26
27
|
let!(:error_description_value) { 'bad bad token' }
|
28
|
+
let(:options) { {} }
|
27
29
|
|
28
30
|
describe '#initialize' do
|
29
31
|
it 'assigns id and secret' do
|
@@ -44,10 +46,10 @@ describe OAuth2::Client do
|
|
44
46
|
end
|
45
47
|
|
46
48
|
it 'is able to pass a block to configure the connection' do
|
47
|
-
connection = double('connection')
|
48
49
|
builder = double('builder')
|
50
|
+
|
49
51
|
allow(Faraday).to receive(:new).and_yield(builder)
|
50
|
-
allow(
|
52
|
+
allow(builder).to receive(:response)
|
51
53
|
|
52
54
|
expect(builder).to receive(:adapter).with(:test)
|
53
55
|
|
@@ -70,7 +72,7 @@ describe OAuth2::Client do
|
|
70
72
|
it 'allows override of raise_errors option' do
|
71
73
|
client = described_class.new('abc', 'def', :site => 'https://api.example.com', :raise_errors => true) do |builder|
|
72
74
|
builder.adapter :test do |stub|
|
73
|
-
stub.get('/notfound') { |
|
75
|
+
stub.get('/notfound') { |_env| [404, {}, nil] }
|
74
76
|
end
|
75
77
|
end
|
76
78
|
expect(client.options[:raise_errors]).to be true
|
@@ -109,6 +111,30 @@ describe OAuth2::Client do
|
|
109
111
|
subject.options[:"#{url_type}_url"] = 'https://api.foo.com/oauth/custom'
|
110
112
|
expect(subject.send("#{url_type}_url")).to eq('https://api.foo.com/oauth/custom')
|
111
113
|
end
|
114
|
+
|
115
|
+
context 'when a URL with path is used in the site' do
|
116
|
+
let(:options) do
|
117
|
+
{:site => 'https://example.com/blog'}
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'generates an authorization URL relative to the site' do
|
121
|
+
expect(subject.send("#{url_type}_url")).to eq("https://example.com/blog/oauth/#{url_type}")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'when a URL with path is used in the site and urls overridden' do
|
126
|
+
let(:options) do
|
127
|
+
{
|
128
|
+
:site => 'https://example.com/blog',
|
129
|
+
:authorize_url => "oauth/#{url_type}/lampoon",
|
130
|
+
:token_url => "oauth/#{url_type}/lampoon",
|
131
|
+
}
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'generates an authorization URL relative to the site' do
|
135
|
+
expect(subject.send("#{url_type}_url")).to eq("https://example.com/blog/oauth/#{url_type}/lampoon")
|
136
|
+
end
|
137
|
+
end
|
112
138
|
end
|
113
139
|
end
|
114
140
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
describe OAuth2::Response do
|
2
4
|
describe '#initialize' do
|
3
5
|
let(:status) { 200 }
|
@@ -75,6 +77,10 @@ describe OAuth2::Response do
|
|
75
77
|
end
|
76
78
|
|
77
79
|
context 'with xml parser registration' do
|
80
|
+
before do
|
81
|
+
MultiXml.parser = :rexml
|
82
|
+
end
|
83
|
+
|
78
84
|
it 'tries to load multi_xml and use it' do
|
79
85
|
expect(described_class.send(:class_variable_get, :@@parsers)[:xml]).not_to be_nil
|
80
86
|
end
|
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'openssl'
|
4
|
+
|
1
5
|
describe OAuth2::Strategy::Assertion do
|
2
|
-
|
6
|
+
let(:client_assertion) { client.assertion }
|
3
7
|
|
4
8
|
let(:client) do
|
5
9
|
cli = OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com')
|
@@ -28,31 +32,81 @@ describe OAuth2::Strategy::Assertion do
|
|
28
32
|
|
29
33
|
describe '#authorize_url' do
|
30
34
|
it 'raises NotImplementedError' do
|
31
|
-
expect {
|
35
|
+
expect { client_assertion.authorize_url }.to raise_error(NotImplementedError)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
35
39
|
%w[json formencoded].each do |mode|
|
36
|
-
|
37
|
-
before do
|
38
|
-
@mode = mode
|
39
|
-
@access = subject.get_token(params)
|
40
|
-
end
|
40
|
+
before { @mode = mode }
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
shared_examples_for "get_token #{mode}" do
|
43
|
+
describe "#get_token (#{mode})" do
|
44
|
+
subject(:get_token) { client_assertion.get_token(params) }
|
45
|
+
|
46
|
+
it 'returns AccessToken with same Client' do
|
47
|
+
expect(get_token.client).to eq(client)
|
48
|
+
end
|
45
49
|
|
46
|
-
|
47
|
-
|
50
|
+
it 'returns AccessToken with #token' do
|
51
|
+
expect(get_token.token).to eq('salmon')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns AccessToken with #expires_in' do
|
55
|
+
expect(get_token.expires_in).to eq(600)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns AccessToken with #expires_at' do
|
59
|
+
expect(get_token.expires_at).not_to be_nil
|
60
|
+
end
|
48
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it_behaves_like "get_token #{mode}"
|
65
|
+
describe "#build_assertion (#{mode})" do
|
66
|
+
context 'with hmac_secret' do
|
67
|
+
subject(:build_assertion) { client_assertion.build_assertion(params) }
|
68
|
+
|
69
|
+
let(:hmac_secret) { '1883be842495c3b58f68ca71fbf1397fbb9ed2fdf8990f8404a25d0a1b995943' }
|
70
|
+
let(:params) do
|
71
|
+
{
|
72
|
+
:iss => 2345,
|
73
|
+
:aud => 'too',
|
74
|
+
:prn => 'much',
|
75
|
+
:exp => 123_456_789,
|
76
|
+
:hmac_secret => hmac_secret,
|
77
|
+
}
|
78
|
+
end
|
79
|
+
let(:jwt) { 'eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOjIzNDUsImF1ZCI6InRvbyIsInBybiI6Im11Y2giLCJleHAiOjEyMzQ1Njc4OX0.GnZjgcdc5WSWKNW0p9S4GuhpBs3LJCEqjPm6turLG-c' }
|
80
|
+
|
81
|
+
it 'returns JWT' do
|
82
|
+
expect(build_assertion).to eq(jwt)
|
83
|
+
end
|
49
84
|
|
50
|
-
|
51
|
-
expect(@access.expires_in).to eq(600)
|
85
|
+
it_behaves_like "get_token #{mode}"
|
52
86
|
end
|
53
87
|
|
54
|
-
|
55
|
-
|
88
|
+
context 'with private_key' do
|
89
|
+
subject(:build_assertion) { client_assertion.build_assertion(params) }
|
90
|
+
|
91
|
+
let(:private_key_file) { 'spec/fixtures/RS256/jwtRS256.key' }
|
92
|
+
let(:password) { '' }
|
93
|
+
let(:private_key) { OpenSSL::PKey::RSA.new(File.read(private_key_file), password) }
|
94
|
+
let(:params) do
|
95
|
+
{
|
96
|
+
:iss => 2345,
|
97
|
+
:aud => 'too',
|
98
|
+
:prn => 'much',
|
99
|
+
:exp => 123_456_789,
|
100
|
+
:private_key => private_key,
|
101
|
+
}
|
102
|
+
end
|
103
|
+
let(:jwt) { 'eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOjIzNDUsImF1ZCI6InRvbyIsInBybiI6Im11Y2giLCJleHAiOjEyMzQ1Njc4OX0.vJ32OiPVMdJrlNkPw02Y9u6beiFY0Mfndhg_CkEDLtOYn8dscQIEpWoR4GzH8tiQVOQ1fOkqxE95tNIKOTjnIoskmYnfzhzIl9fnfQ_lsEuLC-nq45KhPzSM2wYgF2ZEIjDq51daK70bRPzTBr1Id45cTY-jJSito0lbKXj2nPa_Gs-_vyEU2MSxjiMaIxxccfY4Ow5zN3AUMTKp6LjrpDKFxag3fJ1nrb6iDATa504gyJHVLift3ovhAwYidkA81WnmEtISWBY904CKIcZD9Cx3ifS5bc3JaLAteIBKAAyD8o7D60vOKutsjCMHUCKL357BQ36bW7fmaEtW367Ri-xgOsCY0_HeWp991vrJ-DxhFPeuF-8hn_9KggBzKbA2eKEOOY4iDKSFwjWQUFOcRdvHw9RgbGt0IjY3wdo8CaJVlhynh54YlaLgOFhTBPeMgZdqQUHOztljaK9zubeVkrDGNnGuSuq0KR82KArb1x2z7XyZpxiV5ZatP9SNyhn-YIWk7UeQYXaS0UfsBX7L5T1y_FZj84r7Vl42lj1DfdR5DyGvHfZyHotTnejdIrDuQfDL_bGe24eHsilzuEFaajYmu10hxflZ6Apm-lekRRV47tbxTF1zI5we14XsTeklrTXqgDkSw6gyOoNUJm-cQkJpfdvBgUHYGInC1ttz7NU' }
|
104
|
+
|
105
|
+
it 'returns JWT' do
|
106
|
+
expect(build_assertion).to eq(jwt)
|
107
|
+
end
|
108
|
+
|
109
|
+
it_behaves_like "get_token #{mode}"
|
56
110
|
end
|
57
111
|
end
|
58
112
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-02-
|
13
|
+
date: 2022-02-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.17.3
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '3.0'
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
31
|
+
version: 0.17.3
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '3.0'
|
@@ -114,20 +114,6 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '2.3'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: backports
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '3.11'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '3.11'
|
131
117
|
- !ruby/object:Gem::Dependency
|
132
118
|
name: bundler
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,25 +143,19 @@ dependencies:
|
|
157
143
|
- !ruby/object:Gem::Version
|
158
144
|
version: '12.3'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
146
|
+
name: rexml
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
162
148
|
requirements:
|
163
|
-
- - "
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '5.0'
|
166
|
-
- - "<"
|
149
|
+
- - "~>"
|
167
150
|
- !ruby/object:Gem::Version
|
168
|
-
version: '
|
151
|
+
version: '3.2'
|
169
152
|
type: :development
|
170
153
|
prerelease: false
|
171
154
|
version_requirements: !ruby/object:Gem::Requirement
|
172
155
|
requirements:
|
173
|
-
- - "
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
version: '5.0'
|
176
|
-
- - "<"
|
156
|
+
- - "~>"
|
177
157
|
- !ruby/object:Gem::Version
|
178
|
-
version: '
|
158
|
+
version: '3.2'
|
179
159
|
- !ruby/object:Gem::Dependency
|
180
160
|
name: rspec
|
181
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,20 +226,6 @@ dependencies:
|
|
246
226
|
- - ">="
|
247
227
|
- !ruby/object:Gem::Version
|
248
228
|
version: '0'
|
249
|
-
- !ruby/object:Gem::Dependency
|
250
|
-
name: wwtd
|
251
|
-
requirement: !ruby/object:Gem::Requirement
|
252
|
-
requirements:
|
253
|
-
- - ">="
|
254
|
-
- !ruby/object:Gem::Version
|
255
|
-
version: '0'
|
256
|
-
type: :development
|
257
|
-
prerelease: false
|
258
|
-
version_requirements: !ruby/object:Gem::Requirement
|
259
|
-
requirements:
|
260
|
-
- - ">="
|
261
|
-
- !ruby/object:Gem::Version
|
262
|
-
version: '0'
|
263
229
|
description: A Ruby wrapper for the OAuth 2.0 protocol built with a similar style
|
264
230
|
to the original OAuth spec.
|
265
231
|
email:
|
@@ -286,6 +252,9 @@ files:
|
|
286
252
|
- lib/oauth2/strategy/implicit.rb
|
287
253
|
- lib/oauth2/strategy/password.rb
|
288
254
|
- lib/oauth2/version.rb
|
255
|
+
- spec/fixtures/README.md
|
256
|
+
- spec/fixtures/RS256/jwtRS256.key
|
257
|
+
- spec/fixtures/RS256/jwtRS256.key.pub
|
289
258
|
- spec/helper.rb
|
290
259
|
- spec/oauth2/access_token_spec.rb
|
291
260
|
- spec/oauth2/authenticator_spec.rb
|
@@ -304,9 +273,9 @@ licenses:
|
|
304
273
|
- MIT
|
305
274
|
metadata:
|
306
275
|
bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
|
307
|
-
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v1.4.
|
308
|
-
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.
|
309
|
-
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.
|
276
|
+
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v1.4.9/CHANGELOG.md
|
277
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.9
|
278
|
+
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.9
|
310
279
|
wiki_uri: https://github.com/oauth-xx/oauth2/wiki
|
311
280
|
rubygems_mfa_required: 'true'
|
312
281
|
post_install_message:
|
@@ -329,6 +298,9 @@ signing_key:
|
|
329
298
|
specification_version: 4
|
330
299
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|
331
300
|
test_files:
|
301
|
+
- spec/fixtures/README.md
|
302
|
+
- spec/fixtures/RS256/jwtRS256.key
|
303
|
+
- spec/fixtures/RS256/jwtRS256.key.pub
|
332
304
|
- spec/helper.rb
|
333
305
|
- spec/oauth2/access_token_spec.rb
|
334
306
|
- spec/oauth2/authenticator_spec.rb
|