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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9747364f9001f462e35cdc26b209f078daac57834bb4c1a801866f29abc2ba7
4
- data.tar.gz: e03286ea873459b7093baef6c47807edb4a1543889e887bf0d708c0144b6a087
3
+ metadata.gz: 624333537e8e35fa6ece5b46b1748263e023b439060c8e8b6b7ca0572db52ead
4
+ data.tar.gz: 588b9c2328f9ef96fa6709d6d12580083712e863838cb6e3b75b9dfb2e0efe35
5
5
  SHA512:
6
- metadata.gz: bc2238780fe87969d1dea621d44960febb3a19e7b650a5e6ce7939f942e47acd01a825e64c39ab4fb4dbeb5636aef1e0819b3f874b95c22461cee4d63ad44368
7
- data.tar.gz: cc5a2707f9772cc79a3caa3aa96b3c0ffe1a0984fa06446e48a61a9c08240145d772b35b993f11ec24c278367c9db4d2bf35dafee1aa444818323e2aab3c99b6
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 token and update header
60
- token = refresh_client_token_option.call
61
- set_bearer_authorization_header(token)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHC
4
- VERSION ||= '15.0.1'
4
+ VERSION ||= '16.0.0-pro2162'
5
5
  end
@@ -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
- let(:options) { { bearer: initial_token, refresh_client_token: -> { refresh_token } } }
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: 15.0.1
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-05-12 00:00:00.000000000 Z
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: '0'
432
+ version: 1.3.1
433
433
  requirements:
434
434
  - Ruby >= 2.0.0
435
435
  rubygems_version: 3.1.4