oauth2 1.4.7 → 2.0.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 +237 -72
- data/CONTRIBUTING.md +44 -0
- data/LICENSE +1 -1
- data/README.md +446 -146
- data/SECURITY.md +26 -0
- data/lib/oauth2/access_token.rb +66 -25
- data/lib/oauth2/authenticator.rb +12 -5
- data/lib/oauth2/client.rb +192 -95
- data/lib/oauth2/error.rb +43 -24
- data/lib/oauth2/response.rb +79 -22
- data/lib/oauth2/strategy/assertion.rb +66 -39
- data/lib/oauth2/strategy/auth_code.rb +16 -3
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +4 -2
- data/lib/oauth2/strategy/implicit.rb +10 -1
- data/lib/oauth2/strategy/password.rb +3 -1
- data/lib/oauth2/version.rb +1 -59
- data/lib/oauth2.rb +29 -1
- metadata +89 -100
- data/lib/oauth2/mac_token.rb +0 -130
- data/spec/helper.rb +0 -37
- data/spec/oauth2/access_token_spec.rb +0 -216
- data/spec/oauth2/authenticator_spec.rb +0 -84
- data/spec/oauth2/client_spec.rb +0 -506
- data/spec/oauth2/mac_token_spec.rb +0 -117
- data/spec/oauth2/response_spec.rb +0 -90
- data/spec/oauth2/strategy/assertion_spec.rb +0 -58
- data/spec/oauth2/strategy/auth_code_spec.rb +0 -107
- data/spec/oauth2/strategy/base_spec.rb +0 -5
- data/spec/oauth2/strategy/client_credentials_spec.rb +0 -69
- data/spec/oauth2/strategy/implicit_spec.rb +0 -26
- data/spec/oauth2/strategy/password_spec.rb +0 -55
- data/spec/oauth2/version_spec.rb +0 -23
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
8
|
-
- Michael Bleigh
|
9
8
|
- Erik Michaels-Ober
|
9
|
+
- Michael Bleigh
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -18,20 +18,20 @@ 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
|
-
version: '
|
24
|
+
version: '3.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
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
|
-
version: '
|
34
|
+
version: '3.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: jwt
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: multi_json
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.3'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.3'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: multi_xml
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +75,7 @@ dependencies:
|
|
89
75
|
version: '1.2'
|
90
76
|
- - "<"
|
91
77
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
78
|
+
version: '4'
|
93
79
|
type: :runtime
|
94
80
|
prerelease: false
|
95
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -99,111 +85,119 @@ dependencies:
|
|
99
85
|
version: '1.2'
|
100
86
|
- - "<"
|
101
87
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
88
|
+
version: '4'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
90
|
+
name: snaky_hash
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
106
92
|
requirements:
|
107
93
|
- - "~>"
|
108
94
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
110
|
-
type: :
|
95
|
+
version: '2.0'
|
96
|
+
type: :runtime
|
111
97
|
prerelease: false
|
112
98
|
version_requirements: !ruby/object:Gem::Requirement
|
113
99
|
requirements:
|
114
100
|
- - "~>"
|
115
101
|
- !ruby/object:Gem::Version
|
116
|
-
version: '2.
|
102
|
+
version: '2.0'
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
104
|
+
name: version_gem
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
120
106
|
requirements:
|
121
107
|
- - "~>"
|
122
108
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
124
|
-
type: :
|
109
|
+
version: '1.1'
|
110
|
+
type: :runtime
|
125
111
|
prerelease: false
|
126
112
|
version_requirements: !ruby/object:Gem::Requirement
|
127
113
|
requirements:
|
128
114
|
- - "~>"
|
129
115
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
116
|
+
version: '1.1'
|
131
117
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
118
|
+
name: addressable
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
134
120
|
requirements:
|
135
121
|
- - ">="
|
136
122
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
123
|
+
version: '2'
|
138
124
|
type: :development
|
139
125
|
prerelease: false
|
140
126
|
version_requirements: !ruby/object:Gem::Requirement
|
141
127
|
requirements:
|
142
128
|
- - ">="
|
143
129
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
130
|
+
version: '2'
|
145
131
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
132
|
+
name: backports
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
148
134
|
requirements:
|
149
|
-
- - "
|
135
|
+
- - ">="
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
137
|
+
version: '3'
|
152
138
|
type: :development
|
153
139
|
prerelease: false
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
155
141
|
requirements:
|
156
|
-
- - "
|
142
|
+
- - ">="
|
157
143
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
144
|
+
version: '3'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
146
|
+
name: bundler
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
162
148
|
requirements:
|
163
|
-
- - "
|
149
|
+
- - ">="
|
164
150
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
151
|
+
version: '2'
|
166
152
|
type: :development
|
167
153
|
prerelease: false
|
168
154
|
version_requirements: !ruby/object:Gem::Requirement
|
169
155
|
requirements:
|
170
|
-
- - "
|
156
|
+
- - ">="
|
171
157
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
158
|
+
version: '2'
|
173
159
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
160
|
+
name: rake
|
175
161
|
requirement: !ruby/object:Gem::Requirement
|
176
162
|
requirements:
|
177
163
|
- - ">="
|
178
164
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
180
|
-
- - "<"
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: '7'
|
165
|
+
version: '12'
|
183
166
|
type: :development
|
184
167
|
prerelease: false
|
185
168
|
version_requirements: !ruby/object:Gem::Requirement
|
186
169
|
requirements:
|
187
170
|
- - ">="
|
188
171
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
190
|
-
|
172
|
+
version: '12'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: rexml
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
191
178
|
- !ruby/object:Gem::Version
|
192
|
-
version: '
|
179
|
+
version: '3'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '3'
|
193
187
|
- !ruby/object:Gem::Dependency
|
194
188
|
name: rspec
|
195
189
|
requirement: !ruby/object:Gem::Requirement
|
196
190
|
requirements:
|
197
|
-
- - "
|
191
|
+
- - ">="
|
198
192
|
- !ruby/object:Gem::Version
|
199
|
-
version: '3
|
193
|
+
version: '3'
|
200
194
|
type: :development
|
201
195
|
prerelease: false
|
202
196
|
version_requirements: !ruby/object:Gem::Requirement
|
203
197
|
requirements:
|
204
|
-
- - "
|
198
|
+
- - ">="
|
205
199
|
- !ruby/object:Gem::Version
|
206
|
-
version: '3
|
200
|
+
version: '3'
|
207
201
|
- !ruby/object:Gem::Dependency
|
208
202
|
name: rspec-block_is_expected
|
209
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,21 +241,21 @@ dependencies:
|
|
247
241
|
- !ruby/object:Gem::Version
|
248
242
|
version: '0'
|
249
243
|
- !ruby/object:Gem::Dependency
|
250
|
-
name:
|
244
|
+
name: rubocop-lts
|
251
245
|
requirement: !ruby/object:Gem::Requirement
|
252
246
|
requirements:
|
253
|
-
- - "
|
247
|
+
- - "~>"
|
254
248
|
- !ruby/object:Gem::Version
|
255
|
-
version: '0'
|
249
|
+
version: '8.0'
|
256
250
|
type: :development
|
257
251
|
prerelease: false
|
258
252
|
version_requirements: !ruby/object:Gem::Requirement
|
259
253
|
requirements:
|
260
|
-
- - "
|
254
|
+
- - "~>"
|
261
255
|
- !ruby/object:Gem::Version
|
262
|
-
version: '0'
|
256
|
+
version: '8.0'
|
263
257
|
- !ruby/object:Gem::Dependency
|
264
|
-
name:
|
258
|
+
name: silent_stream
|
265
259
|
requirement: !ruby/object:Gem::Requirement
|
266
260
|
requirements:
|
267
261
|
- - ">="
|
@@ -284,14 +278,15 @@ extra_rdoc_files: []
|
|
284
278
|
files:
|
285
279
|
- CHANGELOG.md
|
286
280
|
- CODE_OF_CONDUCT.md
|
281
|
+
- CONTRIBUTING.md
|
287
282
|
- LICENSE
|
288
283
|
- README.md
|
284
|
+
- SECURITY.md
|
289
285
|
- lib/oauth2.rb
|
290
286
|
- lib/oauth2/access_token.rb
|
291
287
|
- lib/oauth2/authenticator.rb
|
292
288
|
- lib/oauth2/client.rb
|
293
289
|
- lib/oauth2/error.rb
|
294
|
-
- lib/oauth2/mac_token.rb
|
295
290
|
- lib/oauth2/response.rb
|
296
291
|
- lib/oauth2/strategy/assertion.rb
|
297
292
|
- lib/oauth2/strategy/auth_code.rb
|
@@ -300,29 +295,35 @@ files:
|
|
300
295
|
- lib/oauth2/strategy/implicit.rb
|
301
296
|
- lib/oauth2/strategy/password.rb
|
302
297
|
- lib/oauth2/version.rb
|
303
|
-
|
304
|
-
- spec/oauth2/access_token_spec.rb
|
305
|
-
- spec/oauth2/authenticator_spec.rb
|
306
|
-
- spec/oauth2/client_spec.rb
|
307
|
-
- spec/oauth2/mac_token_spec.rb
|
308
|
-
- spec/oauth2/response_spec.rb
|
309
|
-
- spec/oauth2/strategy/assertion_spec.rb
|
310
|
-
- spec/oauth2/strategy/auth_code_spec.rb
|
311
|
-
- spec/oauth2/strategy/base_spec.rb
|
312
|
-
- spec/oauth2/strategy/client_credentials_spec.rb
|
313
|
-
- spec/oauth2/strategy/implicit_spec.rb
|
314
|
-
- spec/oauth2/strategy/password_spec.rb
|
315
|
-
- spec/oauth2/version_spec.rb
|
316
|
-
homepage: https://github.com/oauth-xx/oauth2
|
298
|
+
homepage: https://gitlab.com/oauth-xx/oauth2
|
317
299
|
licenses:
|
318
300
|
- MIT
|
319
301
|
metadata:
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
302
|
+
homepage_uri: https://gitlab.com/oauth-xx/oauth2
|
303
|
+
source_code_uri: https://gitlab.com/oauth-xx/oauth2/-/tree/v2.0.9
|
304
|
+
changelog_uri: https://gitlab.com/oauth-xx/oauth2/-/blob/v2.0.9/CHANGELOG.md
|
305
|
+
bug_tracker_uri: https://gitlab.com/oauth-xx/oauth2/-/issues
|
306
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.9
|
307
|
+
wiki_uri: https://gitlab.com/oauth-xx/oauth2/-/wiki
|
308
|
+
funding_uri: https://liberapay.com/pboling
|
309
|
+
rubygems_mfa_required: 'true'
|
310
|
+
post_install_message: |2+
|
311
|
+
|
312
|
+
You have installed oauth2 version 2.0.9, congratulations!
|
313
|
+
|
314
|
+
There are BREAKING changes if you are upgrading from < v2, but most will not encounter them, and updating your code should be easy!
|
315
|
+
|
316
|
+
We have made two other major migrations:
|
317
|
+
1. master branch renamed to main
|
318
|
+
2. Github has been replaced with Gitlab
|
319
|
+
|
320
|
+
Please see:
|
321
|
+
• https://gitlab.com/oauth-xx/oauth2#what-is-new-for-v20
|
322
|
+
• https://gitlab.com/oauth-xx/oauth2/-/blob/main/CHANGELOG.md
|
323
|
+
• https://groups.google.com/g/oauth-ruby/c/QA_dtrXWXaE
|
324
|
+
|
325
|
+
Please report issues, and support the project! Thanks, |7eter l-|. l3oling
|
326
|
+
|
326
327
|
rdoc_options: []
|
327
328
|
require_paths:
|
328
329
|
- lib
|
@@ -330,28 +331,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
331
|
requirements:
|
331
332
|
- - ">="
|
332
333
|
- !ruby/object:Gem::Version
|
333
|
-
version:
|
334
|
+
version: 2.2.0
|
334
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
336
|
requirements:
|
336
337
|
- - ">="
|
337
338
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
339
|
+
version: '0'
|
339
340
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
341
|
+
rubygems_version: 3.3.21
|
341
342
|
signing_key:
|
342
343
|
specification_version: 4
|
343
344
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|
344
|
-
test_files:
|
345
|
-
|
346
|
-
- spec/oauth2/client_spec.rb
|
347
|
-
- spec/oauth2/version_spec.rb
|
348
|
-
- spec/oauth2/authenticator_spec.rb
|
349
|
-
- spec/oauth2/mac_token_spec.rb
|
350
|
-
- spec/oauth2/access_token_spec.rb
|
351
|
-
- spec/oauth2/response_spec.rb
|
352
|
-
- spec/oauth2/strategy/password_spec.rb
|
353
|
-
- spec/oauth2/strategy/client_credentials_spec.rb
|
354
|
-
- spec/oauth2/strategy/assertion_spec.rb
|
355
|
-
- spec/oauth2/strategy/implicit_spec.rb
|
356
|
-
- spec/oauth2/strategy/auth_code_spec.rb
|
357
|
-
- spec/oauth2/strategy/base_spec.rb
|
345
|
+
test_files: []
|
346
|
+
...
|
data/lib/oauth2/mac_token.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require 'digest'
|
3
|
-
require 'openssl'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
module OAuth2
|
7
|
-
class MACToken < AccessToken
|
8
|
-
# Generates a MACToken from an AccessToken and secret
|
9
|
-
#
|
10
|
-
# @param [AccessToken] token the OAuth2::Token instance
|
11
|
-
# @option [String] secret the secret key value
|
12
|
-
# @param [Hash] opts the options to create the Access Token with
|
13
|
-
# @see MACToken#initialize
|
14
|
-
def self.from_access_token(token, secret, options = {})
|
15
|
-
new(token.client, token.token, secret, token.params.merge(:refresh_token => token.refresh_token, :expires_in => token.expires_in, :expires_at => token.expires_at).merge(options))
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :secret, :algorithm
|
19
|
-
|
20
|
-
# Initalize a MACToken
|
21
|
-
#
|
22
|
-
# @param [Client] client the OAuth2::Client instance
|
23
|
-
# @param [String] token the Access Token value
|
24
|
-
# @option [String] secret the secret key value
|
25
|
-
# @param [Hash] opts the options to create the Access Token with
|
26
|
-
# @option opts [String] :refresh_token (nil) the refresh_token value
|
27
|
-
# @option opts [FixNum, String] :expires_in (nil) the number of seconds in which the AccessToken will expire
|
28
|
-
# @option opts [FixNum, String] :expires_at (nil) the epoch time in seconds in which AccessToken will expire
|
29
|
-
# @option opts [FixNum, String] :algorithm (hmac-sha-256) the algorithm to use for the HMAC digest (one of 'hmac-sha-256', 'hmac-sha-1')
|
30
|
-
def initialize(client, token, secret, opts = {})
|
31
|
-
@secret = secret
|
32
|
-
self.algorithm = opts.delete(:algorithm) || 'hmac-sha-256'
|
33
|
-
|
34
|
-
super(client, token, opts)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Make a request with the MAC Token
|
38
|
-
#
|
39
|
-
# @param [Symbol] verb the HTTP request method
|
40
|
-
# @param [String] path the HTTP URL path of the request
|
41
|
-
# @param [Hash] opts the options to make the request with
|
42
|
-
# @see Client#request
|
43
|
-
def request(verb, path, opts = {}, &block)
|
44
|
-
url = client.connection.build_url(path, opts[:params]).to_s
|
45
|
-
|
46
|
-
opts[:headers] ||= {}
|
47
|
-
opts[:headers]['Authorization'] = header(verb, url)
|
48
|
-
|
49
|
-
@client.request(verb, path, opts, &block)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Get the headers hash (always an empty hash)
|
53
|
-
def headers
|
54
|
-
{}
|
55
|
-
end
|
56
|
-
|
57
|
-
# Generate the MAC header
|
58
|
-
#
|
59
|
-
# @param [Symbol] verb the HTTP request method
|
60
|
-
# @param [String] url the HTTP URL path of the request
|
61
|
-
def header(verb, url)
|
62
|
-
timestamp = Time.now.utc.to_i
|
63
|
-
nonce = Digest::MD5.hexdigest([timestamp, SecureRandom.hex].join(':'))
|
64
|
-
|
65
|
-
uri = URI.parse(url)
|
66
|
-
|
67
|
-
raise(ArgumentError, "could not parse \"#{url}\" into URI") unless uri.is_a?(URI::HTTP)
|
68
|
-
|
69
|
-
mac = signature(timestamp, nonce, verb, uri)
|
70
|
-
|
71
|
-
"MAC id=\"#{token}\", ts=\"#{timestamp}\", nonce=\"#{nonce}\", mac=\"#{mac}\""
|
72
|
-
end
|
73
|
-
|
74
|
-
# Generate the Base64-encoded HMAC digest signature
|
75
|
-
#
|
76
|
-
# @param [Fixnum] timestamp the timestamp of the request in seconds since epoch
|
77
|
-
# @param [String] nonce the MAC header nonce
|
78
|
-
# @param [Symbol] verb the HTTP request method
|
79
|
-
# @param [String] url the HTTP URL path of the request
|
80
|
-
def signature(timestamp, nonce, verb, uri)
|
81
|
-
signature = [
|
82
|
-
timestamp,
|
83
|
-
nonce,
|
84
|
-
verb.to_s.upcase,
|
85
|
-
uri.request_uri,
|
86
|
-
uri.host,
|
87
|
-
uri.port,
|
88
|
-
'', nil
|
89
|
-
].join("\n")
|
90
|
-
|
91
|
-
strict_encode64(OpenSSL::HMAC.digest(@algorithm, secret, signature))
|
92
|
-
end
|
93
|
-
|
94
|
-
# Set the HMAC algorithm
|
95
|
-
#
|
96
|
-
# @param [String] alg the algorithm to use (one of 'hmac-sha-1', 'hmac-sha-256')
|
97
|
-
def algorithm=(alg)
|
98
|
-
@algorithm = begin
|
99
|
-
case alg.to_s
|
100
|
-
when 'hmac-sha-1'
|
101
|
-
begin
|
102
|
-
OpenSSL::Digest('SHA1').new
|
103
|
-
rescue StandardError
|
104
|
-
OpenSSL::Digest.new('SHA1')
|
105
|
-
end
|
106
|
-
when 'hmac-sha-256'
|
107
|
-
begin
|
108
|
-
OpenSSL::Digest('SHA256').new
|
109
|
-
rescue StandardError
|
110
|
-
OpenSSL::Digest.new('SHA256')
|
111
|
-
end
|
112
|
-
else
|
113
|
-
raise(ArgumentError, 'Unsupported algorithm')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
private
|
119
|
-
|
120
|
-
# No-op since we need the verb and path
|
121
|
-
# and the MAC always goes in a header
|
122
|
-
def token=(_noop)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Base64.strict_encode64 is not available on Ruby 1.8.7
|
126
|
-
def strict_encode64(str)
|
127
|
-
Base64.encode64(str).delete("\n")
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
data/spec/helper.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
DEBUG = ENV['DEBUG'] == 'true'
|
2
|
-
|
3
|
-
ruby_version = Gem::Version.new(RUBY_VERSION)
|
4
|
-
|
5
|
-
if ruby_version >= Gem::Version.new('2.7')
|
6
|
-
require 'simplecov'
|
7
|
-
require 'coveralls'
|
8
|
-
|
9
|
-
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
10
|
-
|
11
|
-
SimpleCov.start do
|
12
|
-
add_filter '/spec'
|
13
|
-
minimum_coverage(95)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
require 'byebug' if DEBUG && ruby_version >= Gem::Version.new('2.4')
|
18
|
-
|
19
|
-
require 'oauth2'
|
20
|
-
require 'addressable/uri'
|
21
|
-
require 'rspec'
|
22
|
-
require 'rspec/stubbed_env'
|
23
|
-
require 'silent_stream'
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
config.expect_with :rspec do |c|
|
27
|
-
c.syntax = :expect
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Faraday.default_adapter = :test
|
32
|
-
|
33
|
-
RSpec.configure do |conf|
|
34
|
-
conf.include SilentStream
|
35
|
-
end
|
36
|
-
|
37
|
-
VERBS = [:get, :post, :put, :delete].freeze
|