lhc 16.0.0.pre.pro2162 → 16.0.0.pre.pro2162.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/lhc/interceptors/auth.rb +2 -2
- data/lib/lhc/version.rb +1 -1
- data/spec/interceptors/auth/reauthentication_configuration_spec.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30842d2b2811500b9b244e79068e7b9e06d3ad1a8ef904ce750aee9da9ec5362
|
4
|
+
data.tar.gz: 4ec25a8544b9ecb4e717c19fb3b6fae27cccbe331e4ba768a48e6d5899d892da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9b44a11c4bf72c7dd6458149ecebd605973b0862687be7bab72bda4948b4f6bc6595c195177cb60a88ab824c42849a921362b1ba3ee3d95c8015beb59937bc
|
7
|
+
data.tar.gz: 11f43357329692acf312f26d37855e765385ed3f21b98143559011094c053cc26f72e90e875c2f2dc2dfc1251d58ce970bf0c8e17ef92c927efa3350cccfee53
|
data/README.md
CHANGED
@@ -620,7 +620,9 @@ Adds the following to body of all requests:
|
|
620
620
|
|
621
621
|
The current implementation can only offer reauthenticate for _client access tokens_. For this to work the following has to be given:
|
622
622
|
|
623
|
-
* You have configured and implemented `LHC::Auth.refresh_client_token = -> { TokenRefreshUtil.client_access_token(true) }` which when called will force a refresh of the token
|
623
|
+
* You have configured and implemented `LHC::Auth.refresh_client_token = -> { TokenRefreshUtil.client_access_token(refresh: true) }` which when called will force a refresh of the token. It is also expected that this implementation will handle invalidating caches if necessary.
|
624
|
+
* You provide the bearer token as a proc `auth: { bearer: -> { TokenRefreshUtil.client_access_token } }`
|
625
|
+
* Your implementation of the `client_access_token(refresh: true)` proc updates the `client_access_token` to return the refreshed token.
|
624
626
|
* Your interceptors contain `LHC::Auth` and `LHC::Retry`, whereas `LHC::Retry` comes _after_ `LHC::Auth` in the chain.
|
625
627
|
|
626
628
|
##### Bearer Authentication with client access token
|
@@ -97,9 +97,9 @@ class LHC::Auth < LHC::Interceptor
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def refresh_client_token?
|
100
|
-
return true if refresh_client_token_option.is_a?(Proc)
|
100
|
+
return true if refresh_client_token_option.is_a?(Proc) && auth_options[:bearer].is_a?(Proc)
|
101
101
|
|
102
|
-
warn("[WARNING] The given refresh_client_token must be a Proc for reauthentication.")
|
102
|
+
warn("[WARNING] The given refresh_client_token and the given auth bearer must be a Proc for reauthentication.")
|
103
103
|
end
|
104
104
|
|
105
105
|
def retry_interceptor?
|
data/lib/lhc/version.rb
CHANGED
@@ -28,7 +28,7 @@ describe LHC::Auth do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context "configuration check happening" do
|
31
|
-
let(:options) { { bearer: bearer_token, max_recovery_attempts: 1, refresh_client_token: -> { "here comes your refresh code" } } }
|
31
|
+
let(:options) { { bearer: -> { bearer_token }, max_recovery_attempts: 1, refresh_client_token: -> { "here comes your refresh code" } } }
|
32
32
|
|
33
33
|
it "no warning with proper options" do
|
34
34
|
LHC.config.interceptors = [LHC::Auth, LHC::Retry]
|
@@ -40,7 +40,14 @@ describe LHC::Auth do
|
|
40
40
|
it "warn refresh_client_token is a string" do
|
41
41
|
LHC.config.interceptors = [LHC::Auth, LHC::Retry]
|
42
42
|
LHC.config.endpoint(:local, 'http://local.ch', auth: options.merge(refresh_client_token: bearer_token))
|
43
|
-
expect_any_instance_of(described_class).to receive(:warn).with("[WARNING] The given refresh_client_token must be a Proc for reauthentication.")
|
43
|
+
expect_any_instance_of(described_class).to receive(:warn).with("[WARNING] The given refresh_client_token and the given auth bearer must be a Proc for reauthentication.")
|
44
|
+
LHC.get(:local)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "warn auth bearer is a string" do
|
48
|
+
LHC.config.interceptors = [LHC::Auth, LHC::Retry]
|
49
|
+
LHC.config.endpoint(:local, 'http://local.ch', auth: options.merge(bearer: bearer_token))
|
50
|
+
expect_any_instance_of(described_class).to receive(:warn).with("[WARNING] The given refresh_client_token and the given auth bearer must be a Proc for reauthentication.")
|
44
51
|
LHC.get(:local)
|
45
52
|
end
|
46
53
|
|