oauth2 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +249 -0
- data/CODE_OF_CONDUCT.md +133 -0
- data/LICENSE +22 -0
- data/README.md +416 -70
- data/SECURITY.md +14 -0
- data/lib/oauth2/access_token.rb +40 -21
- data/lib/oauth2/authenticator.rb +21 -4
- data/lib/oauth2/client.rb +154 -56
- data/lib/oauth2/error.rb +29 -18
- data/lib/oauth2/response.rb +65 -19
- data/lib/oauth2/snaky_hash.rb +8 -0
- data/lib/oauth2/strategy/assertion.rb +66 -39
- data/lib/oauth2/strategy/auth_code.rb +15 -2
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +3 -1
- data/lib/oauth2/strategy/implicit.rb +10 -1
- data/lib/oauth2/strategy/password.rb +5 -3
- data/lib/oauth2/version.rb +3 -55
- data/lib/oauth2.rb +21 -1
- metadata +208 -35
- data/.document +0 -5
- data/LICENSE.md +0 -20
- data/lib/oauth2/mac_token.rb +0 -122
- data/oauth2.gemspec +0 -25
metadata
CHANGED
@@ -1,15 +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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Peter Boling
|
7
8
|
- Michael Bleigh
|
8
9
|
- Erik Michaels-Ober
|
9
10
|
autorequire:
|
10
|
-
bindir:
|
11
|
+
bindir: exe
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: faraday
|
@@ -17,116 +18,283 @@ dependencies:
|
|
17
18
|
requirements:
|
18
19
|
- - ">="
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
+
version: 0.17.3
|
21
22
|
- - "<"
|
22
23
|
- !ruby/object:Gem::Version
|
23
|
-
version: '0
|
24
|
+
version: '3.0'
|
24
25
|
type: :runtime
|
25
26
|
prerelease: false
|
26
27
|
version_requirements: !ruby/object:Gem::Requirement
|
27
28
|
requirements:
|
28
29
|
- - ">="
|
29
30
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
31
|
+
version: 0.17.3
|
31
32
|
- - "<"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
34
|
+
version: '3.0'
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: jwt
|
36
37
|
requirement: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- - "
|
39
|
+
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '1.0'
|
42
|
+
- - "<"
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.0'
|
41
45
|
type: :runtime
|
42
46
|
prerelease: false
|
43
47
|
version_requirements: !ruby/object:Gem::Requirement
|
44
48
|
requirements:
|
45
|
-
- - "
|
49
|
+
- - ">="
|
46
50
|
- !ruby/object:Gem::Version
|
47
51
|
version: '1.0'
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
48
55
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
56
|
+
name: multi_xml
|
50
57
|
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
59
|
- - "~>"
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
61
|
+
version: '0.5'
|
55
62
|
type: :runtime
|
56
63
|
prerelease: false
|
57
64
|
version_requirements: !ruby/object:Gem::Requirement
|
58
65
|
requirements:
|
59
66
|
- - "~>"
|
60
67
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
68
|
+
version: '0.5'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
70
|
+
name: rack
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
|
-
- - "
|
73
|
+
- - ">="
|
67
74
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
75
|
+
version: '1.2'
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '3'
|
69
79
|
type: :runtime
|
70
80
|
prerelease: false
|
71
81
|
version_requirements: !ruby/object:Gem::Requirement
|
72
82
|
requirements:
|
73
|
-
- - "
|
83
|
+
- - ">="
|
74
84
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
85
|
+
version: '1.2'
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3'
|
76
89
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
90
|
+
name: rash_alt
|
78
91
|
requirement: !ruby/object:Gem::Requirement
|
79
92
|
requirements:
|
80
93
|
- - ">="
|
81
94
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
95
|
+
version: '0.4'
|
83
96
|
- - "<"
|
84
97
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
98
|
+
version: '1'
|
86
99
|
type: :runtime
|
87
100
|
prerelease: false
|
88
101
|
version_requirements: !ruby/object:Gem::Requirement
|
89
102
|
requirements:
|
90
103
|
- - ">="
|
91
104
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
105
|
+
version: '0.4'
|
93
106
|
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: version_gem
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '1.0'
|
116
|
+
type: :runtime
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '1.0'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: addressable
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '2'
|
130
|
+
type: :development
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '2'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: backports
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '3'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
94
149
|
- !ruby/object:Gem::Version
|
95
150
|
version: '3'
|
96
151
|
- !ruby/object:Gem::Dependency
|
97
152
|
name: bundler
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '2'
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '2'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: rake
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '12'
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '12'
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: rexml
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '3'
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '3'
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: rspec
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '3'
|
200
|
+
type: :development
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '3'
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: rspec-block_is_expected
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: rspec-pending_for
|
223
|
+
requirement: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - ">="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
228
|
+
type: :development
|
229
|
+
prerelease: false
|
230
|
+
version_requirements: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
|
+
- !ruby/object:Gem::Dependency
|
236
|
+
name: rspec-stubbed_env
|
237
|
+
requirement: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - ">="
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
242
|
+
type: :development
|
243
|
+
prerelease: false
|
244
|
+
version_requirements: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '0'
|
249
|
+
- !ruby/object:Gem::Dependency
|
250
|
+
name: rubocop-lts
|
98
251
|
requirement: !ruby/object:Gem::Requirement
|
99
252
|
requirements:
|
100
253
|
- - "~>"
|
101
254
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
255
|
+
version: '8.0'
|
103
256
|
type: :development
|
104
257
|
prerelease: false
|
105
258
|
version_requirements: !ruby/object:Gem::Requirement
|
106
259
|
requirements:
|
107
260
|
- - "~>"
|
108
261
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
262
|
+
version: '8.0'
|
263
|
+
- !ruby/object:Gem::Dependency
|
264
|
+
name: silent_stream
|
265
|
+
requirement: !ruby/object:Gem::Requirement
|
266
|
+
requirements:
|
267
|
+
- - ">="
|
268
|
+
- !ruby/object:Gem::Version
|
269
|
+
version: '0'
|
270
|
+
type: :development
|
271
|
+
prerelease: false
|
272
|
+
version_requirements: !ruby/object:Gem::Requirement
|
273
|
+
requirements:
|
274
|
+
- - ">="
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: '0'
|
110
277
|
description: A Ruby wrapper for the OAuth 2.0 protocol built with a similar style
|
111
278
|
to the original OAuth spec.
|
112
279
|
email:
|
113
|
-
-
|
114
|
-
- sferik@gmail.com
|
280
|
+
- peter.boling@gmail.com
|
115
281
|
executables: []
|
116
282
|
extensions: []
|
117
283
|
extra_rdoc_files: []
|
118
284
|
files:
|
119
|
-
-
|
285
|
+
- CHANGELOG.md
|
286
|
+
- CODE_OF_CONDUCT.md
|
120
287
|
- CONTRIBUTING.md
|
121
|
-
- LICENSE
|
288
|
+
- LICENSE
|
122
289
|
- README.md
|
290
|
+
- SECURITY.md
|
123
291
|
- lib/oauth2.rb
|
124
292
|
- lib/oauth2/access_token.rb
|
125
293
|
- lib/oauth2/authenticator.rb
|
126
294
|
- lib/oauth2/client.rb
|
127
295
|
- lib/oauth2/error.rb
|
128
|
-
- lib/oauth2/mac_token.rb
|
129
296
|
- lib/oauth2/response.rb
|
297
|
+
- lib/oauth2/snaky_hash.rb
|
130
298
|
- lib/oauth2/strategy/assertion.rb
|
131
299
|
- lib/oauth2/strategy/auth_code.rb
|
132
300
|
- lib/oauth2/strategy/base.rb
|
@@ -134,11 +302,17 @@ files:
|
|
134
302
|
- lib/oauth2/strategy/implicit.rb
|
135
303
|
- lib/oauth2/strategy/password.rb
|
136
304
|
- lib/oauth2/version.rb
|
137
|
-
-
|
138
|
-
homepage: http://github.com/intridea/oauth2
|
305
|
+
homepage: https://github.com/oauth-xx/oauth2
|
139
306
|
licenses:
|
140
307
|
- MIT
|
141
|
-
metadata:
|
308
|
+
metadata:
|
309
|
+
homepage_uri: https://github.com/oauth-xx/oauth2
|
310
|
+
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v2.0.0
|
311
|
+
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v2.0.0/CHANGELOG.md
|
312
|
+
bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
|
313
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.0
|
314
|
+
wiki_uri: https://github.com/oauth-xx/oauth2/wiki
|
315
|
+
rubygems_mfa_required: 'true'
|
142
316
|
post_install_message:
|
143
317
|
rdoc_options: []
|
144
318
|
require_paths:
|
@@ -147,15 +321,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
321
|
requirements:
|
148
322
|
- - ">="
|
149
323
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
324
|
+
version: 2.2.0
|
151
325
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
326
|
requirements:
|
153
327
|
- - ">="
|
154
328
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
329
|
+
version: '0'
|
156
330
|
requirements: []
|
157
|
-
|
158
|
-
rubygems_version: 2.6.11
|
331
|
+
rubygems_version: 3.3.16
|
159
332
|
signing_key:
|
160
333
|
specification_version: 4
|
161
334
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|
data/.document
DELETED
data/LICENSE.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011-2013 Michael Bleigh and Intridea, Inc.
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/oauth2/mac_token.rb
DELETED
@@ -1,122 +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
|
-
OpenSSL::Digest::SHA1.new
|
102
|
-
when 'hmac-sha-256'
|
103
|
-
OpenSSL::Digest::SHA256.new
|
104
|
-
else
|
105
|
-
raise(ArgumentError, 'Unsupported algorithm')
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
|
-
# No-op since we need the verb and path
|
113
|
-
# and the MAC always goes in a header
|
114
|
-
def token=(_)
|
115
|
-
end
|
116
|
-
|
117
|
-
# Base64.strict_encode64 is not available on Ruby 1.8.7
|
118
|
-
def strict_encode64(str)
|
119
|
-
Base64.encode64(str).delete("\n")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
data/oauth2.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'oauth2/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.add_dependency 'faraday', ['>= 0.8', '< 0.13']
|
9
|
-
spec.add_dependency 'jwt', '~> 1.0'
|
10
|
-
spec.add_dependency 'multi_json', '~> 1.3'
|
11
|
-
spec.add_dependency 'multi_xml', '~> 0.5'
|
12
|
-
spec.add_dependency 'rack', ['>= 1.2', '< 3']
|
13
|
-
spec.add_development_dependency 'bundler', '~> 1.0'
|
14
|
-
spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
|
15
|
-
spec.description = 'A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth spec.'
|
16
|
-
spec.email = ['michael@intridea.com', 'sferik@gmail.com']
|
17
|
-
spec.files = %w[.document CONTRIBUTING.md LICENSE.md README.md oauth2.gemspec] + Dir['lib/**/*.rb']
|
18
|
-
spec.homepage = 'http://github.com/intridea/oauth2'
|
19
|
-
spec.licenses = %w[MIT]
|
20
|
-
spec.name = 'oauth2'
|
21
|
-
spec.require_paths = %w[lib]
|
22
|
-
spec.required_rubygems_version = '>= 1.3.5'
|
23
|
-
spec.summary = 'A Ruby wrapper for the OAuth 2.0 protocol.'
|
24
|
-
spec.version = OAuth2::Version
|
25
|
-
end
|