lhs 26.0.0 → 26.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e54866cbfede61b6c11e099598cd0a8c742d96d58ab7e428f0cf5510713212a
|
4
|
+
data.tar.gz: b4f35820a23216b95316508a2b83d3b90293d575c15f55abd2c8e25807d28451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1de279d402f15a73842204180d3810250e911ab399c4d4636fb7672e3512f3f4f6aed25024594fb483b7bcca690964f2e49858157058a231cae231338b46618
|
7
|
+
data.tar.gz: 607ca09eafde7d9586e01c4c9e1978b97bfc9b8837fda2eec62ddc3e2ec87dc3700687cb5bd3422c3254204bbd86a08cb4636976600e04dba03af097c99106da
|
data/lib/lhs/version.rb
CHANGED
data/spec/auto_oauth_spec.rb
CHANGED
@@ -165,5 +165,46 @@ describe 'Auto OAuth Authentication', type: :request, dummy_models: true do
|
|
165
165
|
expect(records_request).to have_been_requested
|
166
166
|
end
|
167
167
|
end
|
168
|
+
|
169
|
+
context 'overriding auth options with provider enabled for auto oauth' do
|
170
|
+
|
171
|
+
let(:token) { ApplicationController::ACCESS_TOKEN }
|
172
|
+
let(:overridden_token) { 'ACCESS_TOKEN' }
|
173
|
+
|
174
|
+
let(:record_request) do
|
175
|
+
stub_request(:get, "http://internalservice/v2/records/1")
|
176
|
+
.with(
|
177
|
+
headers: { 'Authorization' => "Bearer #{overridden_token}" }
|
178
|
+
).to_return(status: 200, body: { name: 'Record' }.to_json)
|
179
|
+
end
|
180
|
+
|
181
|
+
let(:records_request) do
|
182
|
+
stub_request(:get, "http://internalservice/v2/records?color=blue")
|
183
|
+
.with(
|
184
|
+
headers: { 'Authorization' => "Bearer #{overridden_token}" }
|
185
|
+
).to_return(status: 200, body: { items: [{ name: 'Record' }] }.to_json)
|
186
|
+
end
|
187
|
+
|
188
|
+
before do
|
189
|
+
LHS.configure do |config|
|
190
|
+
config.auto_oauth = -> { access_token }
|
191
|
+
end
|
192
|
+
LHC.configure do |config|
|
193
|
+
config.interceptors = [LHC::Auth]
|
194
|
+
end
|
195
|
+
record_request
|
196
|
+
records_request
|
197
|
+
end
|
198
|
+
|
199
|
+
after do
|
200
|
+
LHC.config.reset
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'applies OAuth credentials for the individual request automatically' do
|
204
|
+
get '/automatic_authentication/oauth_with_provider_override', params: { access_token: overridden_token }
|
205
|
+
expect(record_request).to have_been_requested
|
206
|
+
expect(records_request).to have_been_requested
|
207
|
+
end
|
208
|
+
end
|
168
209
|
end
|
169
210
|
end
|
@@ -26,4 +26,11 @@ class AutomaticAuthenticationController < ApplicationController
|
|
26
26
|
records: DummyRecordWithAutoOauthProvider.where(color: 'blue').as_json
|
27
27
|
}
|
28
28
|
end
|
29
|
+
|
30
|
+
def o_auth_with_provider_override
|
31
|
+
render json: {
|
32
|
+
record: DummyRecordWithAutoOauthProvider.options(auth: { bearer: params[:access_token] }).find(1).as_json,
|
33
|
+
records: DummyRecordWithAutoOauthProvider.options(auth: { bearer: params[:access_token] }).where(color: 'blue').as_json
|
34
|
+
}
|
35
|
+
end
|
29
36
|
end
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -7,6 +7,7 @@ Rails.application.routes.draw do
|
|
7
7
|
get 'automatic_authentication/oauth' => 'automatic_authentication#o_auth'
|
8
8
|
get 'automatic_authentication/oauth_with_multiple_providers' => 'automatic_authentication#o_auth_with_multiple_providers'
|
9
9
|
get 'automatic_authentication/oauth_with_provider' => 'automatic_authentication#o_auth_with_provider'
|
10
|
+
get 'automatic_authentication/oauth_with_provider_override' => 'automatic_authentication#o_auth_with_provider_override'
|
10
11
|
|
11
12
|
# Request Cycle Cache
|
12
13
|
get 'request_cycle_cache/simple' => 'request_cycle_cache#simple'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 26.0.
|
4
|
+
version: 26.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -564,7 +564,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
564
564
|
version: '0'
|
565
565
|
requirements:
|
566
566
|
- Ruby >= 2.3.0
|
567
|
-
rubygems_version: 3.
|
567
|
+
rubygems_version: 3.1.4
|
568
568
|
signing_key:
|
569
569
|
specification_version: 4
|
570
570
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|