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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 624333537e8e35fa6ece5b46b1748263e023b439060c8e8b6b7ca0572db52ead
4
- data.tar.gz: 588b9c2328f9ef96fa6709d6d12580083712e863838cb6e3b75b9dfb2e0efe35
3
+ metadata.gz: 30842d2b2811500b9b244e79068e7b9e06d3ad1a8ef904ce750aee9da9ec5362
4
+ data.tar.gz: 4ec25a8544b9ecb4e717c19fb3b6fae27cccbe331e4ba768a48e6d5899d892da
5
5
  SHA512:
6
- metadata.gz: d038ab78edbddf4f9d3cd8c4f8dd85285448a79498df99f02e9893bf04a68a80fc17fa286555399752452c1e68701307eb2d45112df1bb31df7f96b81c531b23
7
- data.tar.gz: d45a0a5e8990644c7748527affe7fcee24f481f10043f6368ca90a5bbe8b76ad6e32fbfecc85e65e8f21765799926576ad815f443b34617540b6da8594f66d2b
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 and return the new value. It is also expected that this implementation will handle invalidating caches if necessary.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHC
4
- VERSION ||= '16.0.0-pro2162'
4
+ VERSION ||= '16.0.0-pro2162.2'
5
5
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.0.0.pre.pro2162
4
+ version: 16.0.0.pre.pro2162.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors