signet 0.8.1 → 0.9.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 +6 -0
- data/README.md +2 -2
- data/lib/signet/errors.rb +6 -0
- data/lib/signet/oauth_2/client.rb +33 -30
- data/lib/signet/version.rb +2 -2
- data/signet.gemspec +2 -2
- data/spec/signet/oauth_2/client_spec.rb +74 -26
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a9d9e93e57fb53fc7a45b67134f7974e11f15b5c7ea0c6807f0a4cd068964a51
|
4
|
+
data.tar.gz: b9a0806442f9e6fc2a6b68fa8e4e247125dd029335a2a729bdfd8fcc73a7cf96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7655de7dfd4f1cec0bc59ea8347188ba36181735007b9dfd9a3d8daa70ee5db7804d03bbdc89a57ddfdfe53b6e0a56fa75d7b7f13d40419a7620e2e39731cda7
|
7
|
+
data.tar.gz: fa9fbc85f62b104703192145af6512053b53e75508e1d0b813cd43e0e10728113617baf93e31e4338128fea998810a0f0228ab8b51d53aeb5ef7496bdcda16ff
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.9.0 (2018-08-16)
|
2
|
+
* Add RemoteServerError class for 5xx level errors.
|
3
|
+
* Allow to_json to be called with arguments
|
4
|
+
* Expires_in now sets and reflects current expires_at value
|
5
|
+
* Expires_within(0) now returns false when expires_at is nil.
|
6
|
+
|
1
7
|
## 0.8.1 (2017-10-13)
|
2
8
|
|
3
9
|
* Restore support for Ruby 1.9.3
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
<dt>License</dt><dd>Apache 2.0</dd>
|
8
8
|
</dl>
|
9
9
|
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/signet.svg)](https://badge.fury.io/rb/signet)
|
10
11
|
[![Build Status](https://secure.travis-ci.org/google/signet.png)](http://travis-ci.org/google/signet)
|
11
|
-
[![Dependency Status](https://gemnasium.com/google/signet.png)](https://gemnasium.com/google/signet)
|
12
12
|
|
13
13
|
## Description
|
14
14
|
|
@@ -31,7 +31,7 @@ Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|
|
31
31
|
require 'signet/oauth_2/client'
|
32
32
|
client = Signet::OAuth2::Client.new(
|
33
33
|
:authorization_uri => 'https://accounts.google.com/o/oauth2/auth',
|
34
|
-
:token_credential_uri => 'https://
|
34
|
+
:token_credential_uri => 'https://oauth2.googleapis.com/token',
|
35
35
|
:client_id => '44410190108-74nkm6jc5e3vvjqis803frkvmu88cu3a.apps.googleusercontent.com',
|
36
36
|
:client_secret => 'X1NUhvO-rQr9sm8uUSMY8i7v',
|
37
37
|
:scope => 'email profile',
|
data/lib/signet/errors.rb
CHANGED
@@ -33,6 +33,12 @@ module Signet
|
|
33
33
|
class MalformedAuthorizationError < StandardError
|
34
34
|
end
|
35
35
|
|
36
|
+
##
|
37
|
+
# An error indicating that the server failed at processing the request
|
38
|
+
# due to a internal error
|
39
|
+
class RemoteServerError < StandardError
|
40
|
+
end
|
41
|
+
|
36
42
|
##
|
37
43
|
# An error indicating the remote server refused to authorize the client.
|
38
44
|
class AuthorizationError < StandardError
|
@@ -95,7 +95,6 @@ module Signet
|
|
95
95
|
@client_secret = nil
|
96
96
|
@code = nil
|
97
97
|
@expires_at = nil
|
98
|
-
@expires_in = nil
|
99
98
|
@issued_at = nil
|
100
99
|
@issuer = nil
|
101
100
|
@password = nil
|
@@ -723,32 +722,37 @@ module Signet
|
|
723
722
|
|
724
723
|
##
|
725
724
|
# Returns the lifetime of the access token in seconds.
|
725
|
+
# Returns nil if the token does not expire.
|
726
726
|
#
|
727
|
-
# @return [Integer] The access token lifetime.
|
727
|
+
# @return [Integer, nil] The access token lifetime.
|
728
728
|
def expires_in
|
729
|
-
|
729
|
+
if @expires_at.nil? || @issued_at.nil?
|
730
|
+
nil
|
731
|
+
else
|
732
|
+
(@expires_at - @issued_at).to_i
|
733
|
+
end
|
730
734
|
end
|
731
735
|
|
732
736
|
##
|
733
|
-
# Sets the lifetime of the access token in seconds. Resets the
|
734
|
-
# timestamp.
|
737
|
+
# Sets the lifetime of the access token in seconds. Resets the issued_at
|
738
|
+
# timestamp. Nil values will be treated as though the token does
|
739
|
+
# not expire.
|
735
740
|
#
|
736
|
-
# @param [String, Integer] new_expires_in
|
741
|
+
# @param [String, Integer, nil] new_expires_in
|
737
742
|
# The access token lifetime.
|
738
743
|
def expires_in=(new_expires_in)
|
739
744
|
if new_expires_in != nil
|
740
|
-
@expires_in = new_expires_in.to_i
|
741
745
|
@issued_at = Time.now
|
746
|
+
@expires_at = @issued_at + new_expires_in.to_i
|
742
747
|
else
|
743
|
-
@
|
748
|
+
@expires_at, @issued_at = nil, nil
|
744
749
|
end
|
745
|
-
@expires_at = nil
|
746
750
|
end
|
747
751
|
|
748
752
|
##
|
749
753
|
# Returns the timestamp the access token was issued at.
|
750
754
|
#
|
751
|
-
# @return [Time] The access token issuance time.
|
755
|
+
# @return [Time, nil] The access token issuance time.
|
752
756
|
def issued_at
|
753
757
|
return @issued_at
|
754
758
|
end
|
@@ -764,29 +768,26 @@ module Signet
|
|
764
768
|
|
765
769
|
##
|
766
770
|
# Returns the timestamp the access token will expire at.
|
771
|
+
# Returns nil if the token does not expire.
|
767
772
|
#
|
768
|
-
# @return [Time] The access token lifetime.
|
773
|
+
# @return [Time, nil] The access token lifetime.
|
769
774
|
def expires_at
|
770
|
-
|
771
|
-
@expires_at
|
772
|
-
elsif @issued_at && @expires_in
|
773
|
-
return @issued_at + @expires_in
|
774
|
-
else
|
775
|
-
return nil
|
776
|
-
end
|
775
|
+
@expires_at
|
777
776
|
end
|
778
777
|
|
779
778
|
##
|
780
779
|
# Limits the lifetime of the access token as number of seconds since
|
781
|
-
# the Epoch
|
782
|
-
#
|
783
|
-
#
|
780
|
+
# the Epoch. Nil values will be treated as though the token does
|
781
|
+
# not expire.
|
782
|
+
# @param [String,Integer,Time, nil] new_expires_at
|
783
|
+
# The access token expiration time.
|
784
784
|
def expires_at=(new_expires_at)
|
785
|
-
@expires_at = normalize_timestamp
|
785
|
+
@expires_at = normalize_timestamp new_expires_at
|
786
786
|
end
|
787
787
|
|
788
788
|
##
|
789
789
|
# Returns true if the access token has expired.
|
790
|
+
# Returns false if the token has not expired or has an nil @expires_at.
|
790
791
|
#
|
791
792
|
# @return [TrueClass, FalseClass]
|
792
793
|
# The expiration state of the access token.
|
@@ -796,7 +797,7 @@ module Signet
|
|
796
797
|
|
797
798
|
##
|
798
799
|
# Returns true if the access token has expired or expires within
|
799
|
-
# the next n seconds
|
800
|
+
# the next n seconds. Returns false for tokens with a nil @expires_at.
|
800
801
|
#
|
801
802
|
# @param [Integer] sec
|
802
803
|
# Max number of seconds from now where a token is still considered
|
@@ -804,7 +805,7 @@ module Signet
|
|
804
805
|
# @return [TrueClass, FalseClass]
|
805
806
|
# The expiration state of the access token.
|
806
807
|
def expires_within?(sec)
|
807
|
-
return self.expires_at
|
808
|
+
return self.expires_at != nil && Time.now >= (self.expires_at - sec)
|
808
809
|
end
|
809
810
|
|
810
811
|
##
|
@@ -817,7 +818,7 @@ module Signet
|
|
817
818
|
@password = nil
|
818
819
|
@code = nil
|
819
820
|
@issued_at = nil
|
820
|
-
@
|
821
|
+
@expires_at = nil
|
821
822
|
end
|
822
823
|
|
823
824
|
|
@@ -883,7 +884,7 @@ module Signet
|
|
883
884
|
# @note A serialized client contains sensitive information. Persist or transmit with care.
|
884
885
|
#
|
885
886
|
# @return [String] A serialized JSON representation of the client.
|
886
|
-
def to_json
|
887
|
+
def to_json(*)
|
887
888
|
return MultiJson.dump({
|
888
889
|
'authorization_uri' => self.authorization_uri ? self.authorization_uri.to_s : nil,
|
889
890
|
'token_credential_uri' => self.token_credential_uri ? self.token_credential_uri.to_s : nil,
|
@@ -988,6 +989,12 @@ module Signet
|
|
988
989
|
raise ::Signet::AuthorizationError.new(
|
989
990
|
message, :response => response
|
990
991
|
)
|
992
|
+
elsif status.to_s[0] == "5"
|
993
|
+
message = 'Remote server error.'
|
994
|
+
if body.to_s.strip.length > 0
|
995
|
+
message += " Server message:\n#{response.body.to_s.strip}"
|
996
|
+
end
|
997
|
+
raise ::Signet::RemoteServerError.new(message)
|
991
998
|
else
|
992
999
|
message = "Unexpected status code: #{response.status}."
|
993
1000
|
if body.to_s.strip.length > 0
|
@@ -1000,8 +1007,6 @@ module Signet
|
|
1000
1007
|
end
|
1001
1008
|
|
1002
1009
|
def fetch_access_token!(options={})
|
1003
|
-
options = deep_hash_normalize(options)
|
1004
|
-
|
1005
1010
|
token_hash = self.fetch_access_token(options)
|
1006
1011
|
if token_hash
|
1007
1012
|
# No-op for grant types other than `authorization_code`.
|
@@ -1017,8 +1022,6 @@ module Signet
|
|
1017
1022
|
##
|
1018
1023
|
# Refresh the access token, if possible
|
1019
1024
|
def refresh!(options={})
|
1020
|
-
options = deep_hash_normalize(options)
|
1021
|
-
|
1022
1025
|
self.fetch_access_token!(options)
|
1023
1026
|
end
|
1024
1027
|
|
data/lib/signet/version.rb
CHANGED
data/signet.gemspec
CHANGED
@@ -29,8 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_runtime_dependency 'multi_json', '~> 1.10'
|
30
30
|
s.add_runtime_dependency 'jwt', '>= 1.5', '< 3.0'
|
31
31
|
|
32
|
-
s.add_development_dependency 'rake', '~>
|
33
|
-
s.add_development_dependency 'yard', '~> 0.
|
32
|
+
s.add_development_dependency 'rake', '~> 12.0'
|
33
|
+
s.add_development_dependency 'yard', '~> 0.9', '>= 0.9.12'
|
34
34
|
s.add_development_dependency 'rspec', '~> 3.1'
|
35
35
|
s.add_development_dependency 'launchy', '~> 2.4'
|
36
36
|
s.add_development_dependency 'kramdown', '~> 1.5'
|
@@ -187,10 +187,10 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
187
187
|
@key = OpenSSL::PKey::RSA.new 2048
|
188
188
|
@client = Signet::OAuth2::Client.new(
|
189
189
|
:token_credential_uri =>
|
190
|
-
'https://
|
190
|
+
'https://oauth2.googleapis.com/token',
|
191
191
|
:scope => 'https://www.googleapis.com/auth/userinfo.profile',
|
192
192
|
:issuer => 'app@example.com',
|
193
|
-
:audience => 'https://
|
193
|
+
:audience => 'https://oauth2.googleapis.com/token',
|
194
194
|
:signing_key => @key
|
195
195
|
)
|
196
196
|
end
|
@@ -202,7 +202,7 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
202
202
|
claim, header = JWT.decode(jwt, @key.public_key, true, algorithm: 'RS256')
|
203
203
|
expect(claim["iss"]).to eq 'app@example.com'
|
204
204
|
expect(claim["scope"]).to eq 'https://www.googleapis.com/auth/userinfo.profile'
|
205
|
-
expect(claim["aud"]).to eq 'https://
|
205
|
+
expect(claim["aud"]).to eq 'https://oauth2.googleapis.com/token'
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'should generate valid JWTs for impersonation' do
|
@@ -214,7 +214,7 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
214
214
|
expect(claim["iss"]).to eq 'app@example.com'
|
215
215
|
expect(claim["prn"]).to eq 'user@example.com'
|
216
216
|
expect(claim["scope"]).to eq 'https://www.googleapis.com/auth/userinfo.profile'
|
217
|
-
expect(claim["aud"]).to eq 'https://
|
217
|
+
expect(claim["aud"]).to eq 'https://oauth2.googleapis.com/token'
|
218
218
|
end
|
219
219
|
|
220
220
|
it 'should generate valid JWTs for impersonation using deprecated person attribute' do
|
@@ -226,7 +226,7 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
226
226
|
expect(claim["iss"]).to eq 'app@example.com'
|
227
227
|
expect(claim["prn"]).to eq 'user@example.com'
|
228
228
|
expect(claim["scope"]).to eq 'https://www.googleapis.com/auth/userinfo.profile'
|
229
|
-
expect(claim["aud"]).to eq 'https://
|
229
|
+
expect(claim["aud"]).to eq 'https://oauth2.googleapis.com/token'
|
230
230
|
end
|
231
231
|
|
232
232
|
it 'should generate valid JWTs for impersonation using the sub attribute' do
|
@@ -238,7 +238,7 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
238
238
|
expect(claim["iss"]).to eq 'app@example.com'
|
239
239
|
expect(claim["sub"]).to eq 'user@example.com'
|
240
240
|
expect(claim["scope"]).to eq 'https://www.googleapis.com/auth/userinfo.profile'
|
241
|
-
expect(claim["aud"]).to eq 'https://
|
241
|
+
expect(claim["aud"]).to eq 'https://oauth2.googleapis.com/token'
|
242
242
|
end
|
243
243
|
|
244
244
|
it 'should generate a JSON representation of the client' do
|
@@ -247,16 +247,16 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
247
247
|
expect(json).not_to be_nil
|
248
248
|
|
249
249
|
deserialized = MultiJson.load(json)
|
250
|
-
expect(deserialized["token_credential_uri"]).to eq 'https://
|
250
|
+
expect(deserialized["token_credential_uri"]).to eq 'https://oauth2.googleapis.com/token'
|
251
251
|
expect(deserialized["scope"]).to eq ['https://www.googleapis.com/auth/userinfo.profile']
|
252
252
|
expect(deserialized["issuer"]).to eq 'app@example.com'
|
253
|
-
expect(deserialized["audience"]).to eq 'https://
|
253
|
+
expect(deserialized["audience"]).to eq 'https://oauth2.googleapis.com/token'
|
254
254
|
expect(deserialized["signing_key"]).to eq @key.to_s
|
255
255
|
end
|
256
256
|
|
257
257
|
it 'should send valid access token request' do
|
258
258
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
259
|
-
stub.post('/
|
259
|
+
stub.post('/token') do |env|
|
260
260
|
params = Addressable::URI.form_unencode(env[:body])
|
261
261
|
claim, header = JWT.decode(params.assoc("assertion").last, @key.public_key, true, algorithm: 'RS256')
|
262
262
|
expect(params.assoc("grant_type")).to eq ['grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer']
|
@@ -282,10 +282,10 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
282
282
|
@key = 'my secret key'
|
283
283
|
@client = Signet::OAuth2::Client.new(
|
284
284
|
:token_credential_uri =>
|
285
|
-
'https://
|
285
|
+
'https://oauth2.googleapis.com/token',
|
286
286
|
:scope => 'https://www.googleapis.com/auth/userinfo.profile',
|
287
287
|
:issuer => 'app@example.com',
|
288
|
-
:audience => 'https://
|
288
|
+
:audience => 'https://oauth2.googleapis.com/token',
|
289
289
|
:signing_key => @key
|
290
290
|
)
|
291
291
|
end
|
@@ -297,7 +297,7 @@ describe Signet::OAuth2::Client, 'configured for assertions profile' do
|
|
297
297
|
claim, header = JWT.decode(jwt, @key, true, algorithm: 'HS256')
|
298
298
|
expect(claim["iss"]).to eq 'app@example.com'
|
299
299
|
expect(claim["scope"]).to eq 'https://www.googleapis.com/auth/userinfo.profile'
|
300
|
-
expect(claim["aud"]).to eq 'https://
|
300
|
+
expect(claim["aud"]).to eq 'https://oauth2.googleapis.com/token'
|
301
301
|
end
|
302
302
|
end
|
303
303
|
end
|
@@ -308,7 +308,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
308
308
|
:authorization_uri =>
|
309
309
|
'https://accounts.google.com/o/oauth2/auth',
|
310
310
|
:token_credential_uri =>
|
311
|
-
'https://
|
311
|
+
'https://oauth2.googleapis.com/token',
|
312
312
|
:scope => 'https://www.googleapis.com/auth/userinfo.profile'
|
313
313
|
)
|
314
314
|
end
|
@@ -442,9 +442,38 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
442
442
|
expect(@client).to_not be_expired
|
443
443
|
end
|
444
444
|
|
445
|
-
it 'should
|
445
|
+
it 'should set expires_in when expires_at is set' do
|
446
|
+
issued_at = Time.now
|
447
|
+
expires_at = Time.now+100
|
448
|
+
@client.expires_at = expires_at.to_i
|
449
|
+
@client.issued_at = issued_at
|
450
|
+
expect(@client.expires_in).to be_within(1).of (expires_at - issued_at).to_i
|
446
451
|
@client.expires_at = nil
|
447
|
-
expect(@client.
|
452
|
+
expect(@client.expires_in).to be_nil
|
453
|
+
end
|
454
|
+
|
455
|
+
it 'should set expires_in to nil when expires_at is set to nil' do
|
456
|
+
@client.expires_at = nil
|
457
|
+
expect(@client.expires_in).to be_nil
|
458
|
+
end
|
459
|
+
|
460
|
+
it 'should set expires_at when expires_in is set' do
|
461
|
+
expires_in = 100
|
462
|
+
@client.expires_in = expires_in
|
463
|
+
expect(@client.expires_at).to eq (@client.issued_at + expires_in)
|
464
|
+
@client.expires_in = nil
|
465
|
+
expect(@client.expires_at).to be_nil
|
466
|
+
end
|
467
|
+
|
468
|
+
it 'should set expires_at to nil when expires_in is set to nil' do
|
469
|
+
@client.expires_in = nil
|
470
|
+
expect(@client.expires_at).to be_nil
|
471
|
+
end
|
472
|
+
|
473
|
+
it 'should indicate the token is not expired if expired_at nil' do
|
474
|
+
@client.expires_at = nil
|
475
|
+
expect(@client.expires_within?(60)).to be false
|
476
|
+
expect(@client.expired?).to be false
|
448
477
|
end
|
449
478
|
|
450
479
|
it 'should indicate the token is not expiring when expiry beyond window' do
|
@@ -478,7 +507,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
478
507
|
@client.client_id = 'client-12345'
|
479
508
|
@client.client_secret = 'secret-12345'
|
480
509
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
481
|
-
stub.post('/
|
510
|
+
stub.post('/token') do
|
482
511
|
[401, {}, 'User authorization failed or something.']
|
483
512
|
end
|
484
513
|
end
|
@@ -493,14 +522,33 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
493
522
|
stubs.verify_stubbed_calls
|
494
523
|
end
|
495
524
|
|
496
|
-
it 'should raise
|
525
|
+
it 'should raise a remote server error if the server gives a 5xx status' do
|
497
526
|
@client.client_id = 'client-12345'
|
498
527
|
@client.client_secret = 'secret-12345'
|
499
528
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
500
|
-
stub.post('/
|
529
|
+
stub.post('/token') do
|
501
530
|
[509, {}, 'Rate limit hit or something.']
|
502
531
|
end
|
503
532
|
end
|
533
|
+
expect(lambda do
|
534
|
+
connection = Faraday.new(:url => 'https://www.google.com') do |builder|
|
535
|
+
builder.adapter(:test, stubs)
|
536
|
+
end
|
537
|
+
@client.fetch_access_token!(
|
538
|
+
:connection => connection
|
539
|
+
)
|
540
|
+
end).to raise_error(Signet::RemoteServerError)
|
541
|
+
stubs.verify_stubbed_calls
|
542
|
+
end
|
543
|
+
|
544
|
+
it 'should raise an error if the token server gives an unexpected status' do
|
545
|
+
@client.client_id = 'client-12345'
|
546
|
+
@client.client_secret = 'secret-12345'
|
547
|
+
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
548
|
+
stub.post('/token') do
|
549
|
+
[309, {}, 'Rate limit hit or something.']
|
550
|
+
end
|
551
|
+
end
|
504
552
|
expect(lambda do
|
505
553
|
connection = Faraday.new(:url => 'https://www.google.com') do |builder|
|
506
554
|
builder.adapter(:test, stubs)
|
@@ -518,7 +566,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
518
566
|
@client.code = '00000'
|
519
567
|
@client.redirect_uri = 'https://www.example.com/'
|
520
568
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
521
|
-
stub.post('/
|
569
|
+
stub.post('/token') do
|
522
570
|
build_json_response({
|
523
571
|
'access_token' => '12345',
|
524
572
|
'refresh_token' => '54321',
|
@@ -544,7 +592,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
544
592
|
@client.username = 'johndoe'
|
545
593
|
@client.password = 'incognito'
|
546
594
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
547
|
-
stub.post('/
|
595
|
+
stub.post('/token') do
|
548
596
|
build_json_response({
|
549
597
|
'access_token' => '12345',
|
550
598
|
'refresh_token' => '54321',
|
@@ -569,7 +617,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
569
617
|
@client.client_secret = 'secret-12345'
|
570
618
|
@client.refresh_token = '54321'
|
571
619
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
572
|
-
stub.post('/
|
620
|
+
stub.post('/token') do
|
573
621
|
build_json_response({
|
574
622
|
'access_token' => '12345',
|
575
623
|
'refresh_token' => '54321',
|
@@ -755,7 +803,7 @@ JSON
|
|
755
803
|
@client.client_id = 'client-12345'
|
756
804
|
@client.client_secret = 'secret-12345'
|
757
805
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
758
|
-
stub.post('/
|
806
|
+
stub.post('/token') do
|
759
807
|
build_json_response({
|
760
808
|
'access_token' => '12345',
|
761
809
|
'refresh_token' => '54321',
|
@@ -796,7 +844,7 @@ JSON
|
|
796
844
|
@client.client_id = 'client-54321'
|
797
845
|
@client.client_secret = 'secret-12345'
|
798
846
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
799
|
-
stub.post('/
|
847
|
+
stub.post('/token') do
|
800
848
|
build_json_response({
|
801
849
|
'access_token' => '12345',
|
802
850
|
'refresh_token' => '54321',
|
@@ -831,7 +879,7 @@ JSON
|
|
831
879
|
@client.client_id = 'client-12345'
|
832
880
|
@client.client_secret = 'secret-12345'
|
833
881
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
834
|
-
stub.post('/
|
882
|
+
stub.post('/token') do
|
835
883
|
build_json_response({
|
836
884
|
'access_token' => '12345',
|
837
885
|
'refresh_token' => '54321',
|
@@ -861,11 +909,11 @@ JSON
|
|
861
909
|
end
|
862
910
|
|
863
911
|
it 'should raise an error if the id token cannot be verified' do
|
864
|
-
pending "Need to
|
912
|
+
pending "Need to set test data"
|
865
913
|
@client.client_id = 'client-12345'
|
866
914
|
@client.client_secret = 'secret-12345'
|
867
915
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
868
|
-
stub.post('/
|
916
|
+
stub.post('/token') do
|
869
917
|
build_json_response({
|
870
918
|
'access_token' => '12345',
|
871
919
|
'refresh_token' => '54321',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -79,28 +79,34 @@ dependencies:
|
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '12.0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '12.0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: yard
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.9'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.9.12
|
97
100
|
type: :development
|
98
101
|
prerelease: false
|
99
102
|
version_requirements: !ruby/object:Gem::Requirement
|
100
103
|
requirements:
|
101
104
|
- - "~>"
|
102
105
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
106
|
+
version: '0.9'
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.12
|
104
110
|
- !ruby/object:Gem::Dependency
|
105
111
|
name: rspec
|
106
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
233
|
version: 1.3.5
|
228
234
|
requirements: []
|
229
235
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.6
|
236
|
+
rubygems_version: 2.7.6
|
231
237
|
signing_key:
|
232
238
|
specification_version: 4
|
233
239
|
summary: Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|