lhc 15.0.1 → 16.0.0.pre.pro2162
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhc/interceptors/auth.rb +8 -3
- data/lib/lhc/version.rb +1 -1
- data/spec/interceptors/auth/reauthentication_spec.rb +21 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 624333537e8e35fa6ece5b46b1748263e023b439060c8e8b6b7ca0572db52ead
|
4
|
+
data.tar.gz: 588b9c2328f9ef96fa6709d6d12580083712e863838cb6e3b75b9dfb2e0efe35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d038ab78edbddf4f9d3cd8c4f8dd85285448a79498df99f02e9893bf04a68a80fc17fa286555399752452c1e68701307eb2d45112df1bb31df7f96b81c531b23
|
7
|
+
data.tar.gz: d45a0a5e8990644c7748527affe7fcee24f481f10043f6368ca90a5bbe8b76ad6e32fbfecc85e65e8f21765799926576ad815f443b34617540b6da8594f66d2b
|
@@ -56,9 +56,14 @@ class LHC::Auth < LHC::Interceptor
|
|
56
56
|
# rubocop:enable Style/AccessorMethodName
|
57
57
|
|
58
58
|
def reauthenticate!
|
59
|
-
# refresh
|
60
|
-
|
61
|
-
|
59
|
+
# refresh access_token
|
60
|
+
refresh_client_token_option.call
|
61
|
+
|
62
|
+
# Now as the token is refreshe
|
63
|
+
# we need to use the refreshed bearer token
|
64
|
+
# in the authorization header
|
65
|
+
bearer_authentication! if auth_options[:bearer]
|
66
|
+
|
62
67
|
# trigger LHC::Retry and ensure we do not trigger reauthenticate!
|
63
68
|
# again should it fail another time
|
64
69
|
new_options = request.options.dup
|
data/lib/lhc/version.rb
CHANGED
@@ -5,7 +5,10 @@ require 'rails_helper'
|
|
5
5
|
describe LHC::Auth do
|
6
6
|
let(:initial_token) { '123456' }
|
7
7
|
let(:refresh_token) { 'abcdef' }
|
8
|
-
|
8
|
+
|
9
|
+
let(:options) do
|
10
|
+
{ bearer: -> { DummyAuthentication.access_token }, refresh_client_token: -> { DummyAuthentication.refresh_token } }
|
11
|
+
end
|
9
12
|
let!(:auth_failing) do
|
10
13
|
stub_request(:get, 'http://local.ch')
|
11
14
|
.with(headers: { 'Authorization' => "Bearer #{initial_token}" })
|
@@ -17,6 +20,23 @@ describe LHC::Auth do
|
|
17
20
|
end
|
18
21
|
|
19
22
|
before(:each) do
|
23
|
+
class DummyAuthentication
|
24
|
+
|
25
|
+
def self.refresh_token
|
26
|
+
# updates access_token
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.access_token
|
30
|
+
# this is used as bearer token
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# It does not matter what value this method returns it is not use by LHC.
|
35
|
+
# That method needs just to make sure that the value of the access_token
|
36
|
+
# is the new valid token
|
37
|
+
allow(DummyAuthentication).to receive(:refresh_token).and_return(nil)
|
38
|
+
|
39
|
+
allow(DummyAuthentication).to receive(:access_token).and_return(initial_token, refresh_token)
|
20
40
|
LHC.config.interceptors = [LHC::Auth, LHC::Retry]
|
21
41
|
end
|
22
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 16.0.0.pre.pro2162
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhc/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -427,9 +427,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
427
427
|
version: '2.7'
|
428
428
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
429
429
|
requirements:
|
430
|
-
- - "
|
430
|
+
- - ">"
|
431
431
|
- !ruby/object:Gem::Version
|
432
|
-
version:
|
432
|
+
version: 1.3.1
|
433
433
|
requirements:
|
434
434
|
- Ruby >= 2.0.0
|
435
435
|
rubygems_version: 3.1.4
|