lhs 21.2.3.pre.preload.pre.providers.pre.too.1 → 21.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +240 -107
- data/lhs.gemspec +1 -1
- data/lib/lhs.rb +8 -0
- data/lib/lhs/concerns/o_auth.rb +25 -0
- data/lib/lhs/concerns/record/configuration.rb +28 -11
- data/lib/lhs/concerns/record/request.rb +29 -8
- data/lib/lhs/config.rb +1 -1
- data/lib/lhs/interceptors/auto_oauth/interceptor.rb +33 -0
- data/lib/lhs/interceptors/auto_oauth/thread_registry.rb +18 -0
- data/lib/lhs/version.rb +1 -1
- data/spec/auto_oauth_spec.rb +169 -0
- data/spec/dummy/app/controllers/application_controller.rb +15 -0
- data/spec/dummy/app/controllers/automatic_authentication_controller.rb +29 -0
- data/spec/dummy/app/models/dummy_record_with_auto_oauth_provider.rb +6 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_oauth_providers1.rb +7 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_oauth_providers2.rb +7 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_providers_per_endpoint.rb +6 -0
- data/spec/dummy/app/models/dummy_record_with_oauth.rb +7 -0
- data/spec/dummy/app/models/providers/internal_services.rb +7 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/record/error_handling_integration_spec.rb +1 -1
- data/spec/record/includes_spec.rb +19 -0
- data/spec/request_cycle_cache_spec.rb +3 -3
- metadata +27 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43753bff8b039bf6b5b2384333afcc1d09da6c61f1616b06751c7a023e0fbc0
|
4
|
+
data.tar.gz: ee5cd17ace1e7f82fc8a713dc493543e800658bd76909ddb026951d84f31c2df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d9ddf1745b15e1c635060eec564a3e578f31829e24dede722ca5509a1dffeefec3fb0daaeb27c94f3c9854314d41fe9042cccfbd04ca3fdc2bab3a32bb9120
|
7
|
+
data.tar.gz: ac97fc333b97f8492bc519b401b68377af441e398486ceaea183d8b006015b691d1aad9a0f518ebf5367cf4427098d767e96354813da94807021195a38f3e997
|
data/README.md
CHANGED
@@ -39,113 +39,118 @@ record.review # "Lunch was great
|
|
39
39
|
|
40
40
|
## Table of contents
|
41
41
|
* [LHS](#lhs)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
42
|
+
* [Quickstart](#quickstart)
|
43
|
+
* [Installation/Startup checklist](#installationstartup-checklist)
|
44
|
+
* [Record](#record)
|
45
|
+
* [Endpoints](#endpoints)
|
46
|
+
* [Configure endpoint hosts](#configure-endpoint-hosts)
|
47
|
+
* [Endpoint Priorities](#endpoint-priorities)
|
48
|
+
* [Provider](#provider)
|
49
|
+
* [Record inheritance](#record-inheritance)
|
50
|
+
* [Find multiple records](#find-multiple-records)
|
51
|
+
* [fetch](#fetch)
|
52
|
+
* [where](#where)
|
53
|
+
* [Reuse/Dry where statements: Use scopes](#reusedry-where-statements-use-scopes)
|
54
|
+
* [all](#all)
|
55
|
+
* [all with unpaginated endpoints](#all-with-unpaginated-endpoints)
|
56
|
+
* [Retrieve the amount of a collection of items: count vs. length](#retrieve-the-amount-of-a-collection-of-items-count-vs-length)
|
57
|
+
* [Find single records](#find-single-records)
|
58
|
+
* [find](#find)
|
59
|
+
* [find_by](#find_by)
|
60
|
+
* [first](#first)
|
61
|
+
* [last](#last)
|
62
|
+
* [Work with retrieved data](#work-with-retrieved-data)
|
63
|
+
* [Automatic detection/conversion of collections](#automatic-detectionconversion-of-collections)
|
64
|
+
* [Map complex data for easy access](#map-complex-data-for-easy-access)
|
65
|
+
* [Access and identify nested records](#access-and-identify-nested-records)
|
66
|
+
* [Relations / Associations](#relations--associations)
|
67
|
+
* [has_many](#has_many)
|
68
|
+
* [has_one](#has_one)
|
69
|
+
* [Unwrap nested items from the response body](#unwrap-nested-items-from-the-response-body)
|
70
|
+
* [Determine collections from the response body](#determine-collections-from-the-response-body)
|
71
|
+
* [Load additional data based on retrieved data](#load-additional-data-based-on-retrieved-data)
|
72
|
+
* [Chain complex queries](#chain-complex-queries)
|
73
|
+
* [Chain where queries](#chain-where-queries)
|
74
|
+
* [Expand plain collections of links: expanded](#expand-plain-collections-of-links-expanded)
|
75
|
+
* [Error handling with chains](#error-handling-with-chains)
|
76
|
+
* [Resolve chains: fetch](#resolve-chains-fetch)
|
77
|
+
* [Add request options to a query chain: options](#add-request-options-to-a-query-chain-options)
|
78
|
+
* [Control pagination within a query chain](#control-pagination-within-a-query-chain)
|
79
|
+
* [Record pagination](#record-pagination)
|
80
|
+
* [Pagination strategy](#pagination-strategy)
|
81
|
+
* [Pagination strategy: offset (default)](#pagination-strategy-offset-default)
|
82
|
+
* [Pagination strategy: page](#pagination-strategy-page)
|
83
|
+
* [Pagination strategy: start](#pagination-strategy-start)
|
84
|
+
* [Pagination strategy: link](#pagination-strategy-link)
|
85
|
+
* [Pagination keys](#pagination-keys)
|
86
|
+
* [limit_key](#limit_key)
|
87
|
+
* [pagination_key](#pagination_key)
|
88
|
+
* [total_key](#total_key)
|
89
|
+
* [Pagination links](#pagination-links)
|
90
|
+
* [next?](#next)
|
91
|
+
* [previous?](#previous)
|
92
|
+
* [Kaminari support (limited)](#kaminari-support-limited)
|
93
|
+
* [Build, create and update records](#build-create-and-update-records)
|
94
|
+
* [Create new records](#create-new-records)
|
95
|
+
* [create](#create)
|
96
|
+
* [Unwrap nested data when creation response nests created record data](#unwrap-nested-data-when-creation-response-nests-created-record-data)
|
97
|
+
* [Create records through associations: Nested sub resources](#create-records-through-associations-nested-sub-resources)
|
98
|
+
* [Start building new records](#start-building-new-records)
|
99
|
+
* [Change/Update existing records](#changeupdate-existing-records)
|
100
|
+
* [save](#save)
|
101
|
+
* [update](#update)
|
102
|
+
* [partial_update](#partial_update)
|
103
|
+
* [Endpoint url parameter injection during record creation/change](#endpoint-url-parameter-injection-during-record-creationchange)
|
104
|
+
* [Record validation](#record-validation)
|
105
|
+
* [Configure record validations](#configure-record-validations)
|
106
|
+
* [HTTP Status Codes for validation errors](#http-status-codes-for-validation-errors)
|
107
|
+
* [Reset validation errors](#reset-validation-errors)
|
108
|
+
* [Add validation errors](#add-validation-errors)
|
109
|
+
* [Validation errors for nested data](#validation-errors-for-nested-data)
|
110
|
+
* [Translation of validation errors](#translation-of-validation-errors)
|
111
|
+
* [Validation error types: errors vs. warnings](#validation-error-types-errors-vs-warnings)
|
112
|
+
* [Persistance failed: errors](#persistance-failed-errors)
|
113
|
+
* [Persistance succeeded: warnings](#persistance-succeeded-warnings)
|
114
|
+
* [Using ActiveModel::Validations none the less](#using-activemodelvalidations-none-the-less)
|
115
|
+
* [Use form_helper to create and update records](#use-form_helper-to-create-and-update-records)
|
116
|
+
* [Destroy records](#destroy-records)
|
117
|
+
* [Record getters and setters](#record-getters-and-setters)
|
118
|
+
* [Record setters](#record-setters)
|
119
|
+
* [Record getters](#record-getters)
|
120
|
+
* [Include linked resources (hyperlinks and hypermedia)](#include-linked-resources-hyperlinks-and-hypermedia)
|
121
|
+
* [Generate links from parameters](#generate-links-from-parameters)
|
122
|
+
* [Ensure the whole linked collection is included: includes_all](#ensure-the-whole-linked-collection-is-included-includes_all)
|
123
|
+
* [Include the first linked page or single item is included: include](#include-the-first-linked-page-or-single-item-is-included-include)
|
124
|
+
* [Include various levels of linked data](#include-various-levels-of-linked-data)
|
125
|
+
* [Identify and cast known records when including records](#identify-and-cast-known-records-when-including-records)
|
126
|
+
* [Apply options for requests performed to fetch included records](#apply-options-for-requests-performed-to-fetch-included-records)
|
127
|
+
* [Record batch processing](#record-batch-processing)
|
128
|
+
* [all](#all-1)
|
129
|
+
* [Using all, when endpoint does not implement response pagination meta data](#using-all-when-endpoint-does-not-implement-response-pagination-meta-data)
|
130
|
+
* [find_each](#find_each)
|
131
|
+
* [find_in_batches](#find_in_batches)
|
132
|
+
* [Convert/Cast specific record types: becomes](#convertcast-specific-record-types-becomes)
|
133
|
+
* [Assign attributes](#assign-attributes)
|
134
|
+
* [Request Cycle Cache](#request-cycle-cache)
|
135
|
+
* [Change store for LHS' request cycle cache](#change-store-for-lhs-request-cycle-cache)
|
136
|
+
* [Disable request cycle cache](#disable-request-cycle-cache)
|
137
|
+
* [Automatic Authentication (OAuth)](#automatic-authentication-oauth)
|
138
|
+
* [Configure multiple auth providers (even per endpoint)](#configure-multiple-auth-providers-even-per-endpoint)
|
139
|
+
* [Configure providers](#configure-providers)
|
140
|
+
* [Option Blocks](#option-blocks)
|
141
|
+
* [Request tracing](#request-tracing)
|
142
|
+
* [Extended Rollbar Logging](#extended-rollbar-logging)
|
143
|
+
* [Testing with LHS](#testing-with-lhs)
|
144
|
+
* [Test helper](#test-helper)
|
145
|
+
* [Stub](#stub)
|
146
|
+
* [stub_all](#stub_all)
|
147
|
+
* [Test query chains](#test-query-chains)
|
148
|
+
* [By explicitly resolving the chain: fetch](#by-explicitly-resolving-the-chain-fetch)
|
149
|
+
* [Without resolving the chain: where_values_hash](#without-resolving-the-chain-where_values_hash)
|
150
|
+
* [License](#license)
|
151
|
+
|
152
|
+
|
153
|
+
|
149
154
|
|
150
155
|
## Installation/Startup checklist
|
151
156
|
|
@@ -2444,6 +2449,134 @@ LHS.configure do |config|
|
|
2444
2449
|
end
|
2445
2450
|
```
|
2446
2451
|
|
2452
|
+
## Automatic Authentication (OAuth)
|
2453
|
+
|
2454
|
+
LHS provides a way to have records automatically fetch and use OAuth authentication when performing requests within Rails.
|
2455
|
+
|
2456
|
+
In order to enable automatic oauth authentication, perform the following steps:
|
2457
|
+
|
2458
|
+
1. Make sure LHS is configured to perform `auto_oauth`. Provide a block that, when executed in the controller context, returns a valid access_token/bearer_token.
|
2459
|
+
```ruby
|
2460
|
+
# config/initializers/lhs.rb
|
2461
|
+
|
2462
|
+
LHS.configure do |config|
|
2463
|
+
config.auto_oauth = -> { access_token }
|
2464
|
+
end
|
2465
|
+
```
|
2466
|
+
|
2467
|
+
2. Opt-in records requiring oauth authentication:
|
2468
|
+
|
2469
|
+
```ruby
|
2470
|
+
# app/models/record.rb
|
2471
|
+
|
2472
|
+
class Record < LHS::Record
|
2473
|
+
oauth
|
2474
|
+
# ...
|
2475
|
+
end
|
2476
|
+
```
|
2477
|
+
|
2478
|
+
3. Include the `LHS::OAuth` context into your application controller:
|
2479
|
+
|
2480
|
+
```ruby
|
2481
|
+
# app/controllers/application_controller.rb
|
2482
|
+
|
2483
|
+
class ApplicationController < ActionController::Base
|
2484
|
+
include LHS::OAuth
|
2485
|
+
|
2486
|
+
# ...
|
2487
|
+
end
|
2488
|
+
```
|
2489
|
+
|
2490
|
+
4. Make sure you have the `LHC::Auth` interceptor enabled:
|
2491
|
+
|
2492
|
+
```ruby
|
2493
|
+
# config/initializers/lhc.rb
|
2494
|
+
|
2495
|
+
LHC.configure do |config|
|
2496
|
+
config.interceptors = [LHC::Auth]
|
2497
|
+
end
|
2498
|
+
```
|
2499
|
+
|
2500
|
+
Now you can perform requests based on the record that will be auto authenticated from now on:
|
2501
|
+
|
2502
|
+
```ruby
|
2503
|
+
# app/controllers/some_controller.rb
|
2504
|
+
|
2505
|
+
Record.find(1)
|
2506
|
+
```
|
2507
|
+
```
|
2508
|
+
https://records/1
|
2509
|
+
Authentication: 'Bearer token-12345'
|
2510
|
+
```
|
2511
|
+
|
2512
|
+
### Configure multiple auth providers (even per endpoint)
|
2513
|
+
|
2514
|
+
In case you need to configure multiple auth provider access_tokens within your application,
|
2515
|
+
make sure you provide a proc returning a hash when configuring `auto_oauth`,
|
2516
|
+
naming every single provider and the responsive method to retrieve the access_tokens in the controller context:
|
2517
|
+
|
2518
|
+
```ruby
|
2519
|
+
# config/initializers/lhs.rb
|
2520
|
+
LHS.configure do |config|
|
2521
|
+
config.auto_oauth = proc do
|
2522
|
+
{
|
2523
|
+
provider1: access_token_provider_1,
|
2524
|
+
provider2: access_token_provider_2
|
2525
|
+
}
|
2526
|
+
end
|
2527
|
+
end
|
2528
|
+
```
|
2529
|
+
|
2530
|
+
Then make sure you either define which provider to use on a record level:
|
2531
|
+
|
2532
|
+
```ruby
|
2533
|
+
# model/record.rb
|
2534
|
+
class Record < LHS::Record
|
2535
|
+
oauth(:provider1)
|
2536
|
+
#...
|
2537
|
+
end
|
2538
|
+
```
|
2539
|
+
|
2540
|
+
or on an endpoint level:
|
2541
|
+
|
2542
|
+
```ruby
|
2543
|
+
# model/record.rb
|
2544
|
+
class Record < LHS::Record
|
2545
|
+
endpoint 'https://service/records', oauth: :provider1
|
2546
|
+
#...
|
2547
|
+
end
|
2548
|
+
```
|
2549
|
+
|
2550
|
+
### Configure providers
|
2551
|
+
|
2552
|
+
If you're using LHS service providers, you can also configure auto auth on a provider level:
|
2553
|
+
|
2554
|
+
```ruby
|
2555
|
+
# app/models/providers/localsearch.rb
|
2556
|
+
module Providers
|
2557
|
+
class Localsearch < LHS::Record
|
2558
|
+
|
2559
|
+
provider(
|
2560
|
+
oauth: true
|
2561
|
+
)
|
2562
|
+
end
|
2563
|
+
end
|
2564
|
+
```
|
2565
|
+
|
2566
|
+
or with multiple auth providers:
|
2567
|
+
|
2568
|
+
```ruby
|
2569
|
+
# app/models/providers/localsearch.rb
|
2570
|
+
module Providers
|
2571
|
+
class Localsearch < LHS::Record
|
2572
|
+
|
2573
|
+
provider(
|
2574
|
+
oauth: :provider_1
|
2575
|
+
)
|
2576
|
+
end
|
2577
|
+
end
|
2578
|
+
```
|
2579
|
+
|
2447
2580
|
## Option Blocks
|
2448
2581
|
|
2449
2582
|
In order to apply options to all requests performed in a give block, LHS provides option blocks.
|
data/lhs.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_development_dependency 'pry'
|
33
33
|
s.add_development_dependency 'pry-byebug'
|
34
34
|
s.add_development_dependency 'rails', '>= 4.2.11'
|
35
|
-
s.add_development_dependency 'rollbar'
|
35
|
+
s.add_development_dependency 'rollbar', '<= 2.24.0'
|
36
36
|
s.add_development_dependency 'rspec-rails', '>= 3.7.0'
|
37
37
|
s.add_development_dependency 'rubocop', '~> 0.57.1'
|
38
38
|
s.add_development_dependency 'rubocop-rspec', '~> 1.26.0'
|
data/lib/lhs.rb
CHANGED
@@ -22,6 +22,12 @@ module LHS
|
|
22
22
|
autoload :Inspect,
|
23
23
|
'lhs/concerns/inspect'
|
24
24
|
module Interceptors
|
25
|
+
module AutoOauth
|
26
|
+
autoload :ThreadRegistry,
|
27
|
+
'lhs/interceptors/auto_oauth/thread_registry'
|
28
|
+
autoload :Interceptor,
|
29
|
+
'lhs/interceptors/auto_oauth/interceptor'
|
30
|
+
end
|
25
31
|
module RequestCycleCache
|
26
32
|
autoload :ThreadRegistry,
|
27
33
|
'lhs/interceptors/request_cycle_cache/thread_registry'
|
@@ -41,6 +47,8 @@ module LHS
|
|
41
47
|
'lhs/concerns/is_href'
|
42
48
|
autoload :Item,
|
43
49
|
'lhs/item'
|
50
|
+
autoload :OAuth,
|
51
|
+
'lhs/concerns/o_auth.rb'
|
44
52
|
autoload :OptionBlocks,
|
45
53
|
'lhs/concerns/option_blocks'
|
46
54
|
autoload :Pagination,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
module LHS
|
6
|
+
module OAuth
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
prepend_before_action :lhs_store_oauth_access_token
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def lhs_store_oauth_access_token
|
16
|
+
lhs_check_auto_oauth_enabled!
|
17
|
+
LHS::Interceptors::AutoOauth::ThreadRegistry.access_token = instance_exec(&LHS.config.auto_oauth)
|
18
|
+
end
|
19
|
+
|
20
|
+
def lhs_check_auto_oauth_enabled!
|
21
|
+
return if LHS.config.auto_oauth.present? && LHS.config.auto_oauth.is_a?(Proc)
|
22
|
+
raise 'You have to enable LHS.config.auto_oauth by passing a proc returning an access token!'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -12,45 +12,62 @@ class LHS::Record
|
|
12
12
|
mattr_accessor :configuration
|
13
13
|
|
14
14
|
module ClassMethods
|
15
|
-
def configuration(args)
|
16
|
-
|
15
|
+
def configuration(args = nil)
|
16
|
+
if !args.nil?
|
17
|
+
@configuration = args
|
18
|
+
else
|
19
|
+
@configuration || {}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def auto_oauth?
|
24
|
+
LHS.config.auto_oauth && configuration && auto_oauth
|
25
|
+
end
|
26
|
+
|
27
|
+
def auto_oauth
|
28
|
+
configuration.fetch(:auto_oauth, false)
|
29
|
+
end
|
30
|
+
|
31
|
+
def oauth(provider = nil)
|
32
|
+
value = provider || true
|
33
|
+
configuration.present? ? configuration.merge!(auto_oauth: value) : configuration(auto_oauth: value)
|
17
34
|
end
|
18
35
|
|
19
36
|
def item_key
|
20
37
|
symbolize_unless_complex(
|
21
|
-
|
38
|
+
configuration.dig(:item_key) || :item
|
22
39
|
)
|
23
40
|
end
|
24
41
|
|
25
42
|
def items_key
|
26
43
|
symbolize_unless_complex(
|
27
|
-
|
44
|
+
configuration.dig(:items_key) || :items
|
28
45
|
)
|
29
46
|
end
|
30
47
|
|
31
48
|
def item_created_key
|
32
49
|
symbolize_unless_complex(
|
33
|
-
|
50
|
+
configuration.dig(:item_created_key)
|
34
51
|
)
|
35
52
|
end
|
36
53
|
|
37
54
|
def limit_key(type = nil)
|
38
55
|
symbolize_unless_complex(
|
39
|
-
pagination_parameter(
|
56
|
+
pagination_parameter(configuration.dig(:limit_key), type) ||
|
40
57
|
:limit
|
41
58
|
)
|
42
59
|
end
|
43
60
|
|
44
61
|
def total_key
|
45
62
|
symbolize_unless_complex(
|
46
|
-
|
63
|
+
configuration.dig(:total_key) || :total
|
47
64
|
)
|
48
65
|
end
|
49
66
|
|
50
67
|
# Key used for determine current page
|
51
68
|
def pagination_key(type = nil)
|
52
69
|
symbolize_unless_complex(
|
53
|
-
pagination_parameter(
|
70
|
+
pagination_parameter(configuration.dig(:pagination_key), type) ||
|
54
71
|
:offset
|
55
72
|
)
|
56
73
|
end
|
@@ -58,15 +75,15 @@ class LHS::Record
|
|
58
75
|
# Strategy used for calculationg next pages and navigate pages
|
59
76
|
def pagination_strategy
|
60
77
|
symbolize_unless_complex(
|
61
|
-
|
78
|
+
configuration.dig(:pagination_strategy) || :offset
|
62
79
|
)
|
63
80
|
end
|
64
81
|
|
65
82
|
# Allows record to be configured as not paginated,
|
66
83
|
# as by default it's considered paginated
|
67
84
|
def paginated
|
68
|
-
return true if
|
69
|
-
|
85
|
+
return true if configuration.blank?
|
86
|
+
configuration.fetch(:paginated, true)
|
70
87
|
end
|
71
88
|
|
72
89
|
private
|
@@ -246,7 +246,9 @@ class LHS::Record
|
|
246
246
|
def skip_loading_includes?(data, included)
|
247
247
|
if data.collection?
|
248
248
|
data.to_a.none? { |item| item[included].present? }
|
249
|
-
elsif data
|
249
|
+
elsif data.dig(included).blank?
|
250
|
+
true
|
251
|
+
elsif data[included].item? && data[included][:href].blank?
|
250
252
|
true
|
251
253
|
else
|
252
254
|
!data._raw.key?(included)
|
@@ -515,20 +517,39 @@ class LHS::Record
|
|
515
517
|
options[:url] = compute_url!(options[:params]) unless options.key?(:url)
|
516
518
|
merge_explicit_params!(options[:params])
|
517
519
|
options.delete(:params) if options[:params]&.empty?
|
518
|
-
|
520
|
+
inject_interceptors!(options)
|
519
521
|
options
|
520
522
|
end
|
521
523
|
|
522
|
-
|
523
|
-
|
524
|
-
|
524
|
+
def inject_interceptors!(options)
|
525
|
+
if LHS.config.request_cycle_cache_enabled
|
526
|
+
inject_interceptor!(
|
527
|
+
options,
|
528
|
+
LHS::Interceptors::RequestCycleCache::Interceptor,
|
529
|
+
LHC::Caching,
|
530
|
+
"[WARNING] Can't enable request cycle cache as LHC::Caching interceptor is not enabled/configured (see https://github.com/local-ch/lhc/blob/master/README.md#caching-interceptor)!"
|
531
|
+
)
|
532
|
+
end
|
533
|
+
|
534
|
+
endpoint = find_endpoint(options[:params], options.fetch(:url, nil))
|
535
|
+
if auto_oauth? || (endpoint.options&.dig(:oauth) && LHS.config.auto_oauth) || options[:oauth]
|
536
|
+
inject_interceptor!(
|
537
|
+
options.merge!(record: self),
|
538
|
+
LHS::Interceptors::AutoOauth::Interceptor,
|
539
|
+
LHC::Auth,
|
540
|
+
"[WARNING] Can't enable auto oauth as LHC::Auth interceptor is not enabled/configured (see https://github.com/local-ch/lhc/blob/master/README.md#authentication-interceptor)!"
|
541
|
+
)
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
def inject_interceptor!(options, interceptor, dependecy, warning)
|
525
546
|
interceptors = options[:interceptors] || LHC.config.interceptors
|
526
|
-
if interceptors.include?(
|
547
|
+
if interceptors.include?(dependecy)
|
527
548
|
# Ensure interceptor is prepend
|
528
|
-
interceptors = interceptors.unshift(
|
549
|
+
interceptors = interceptors.unshift(interceptor)
|
529
550
|
options[:interceptors] = interceptors
|
530
551
|
else
|
531
|
-
warn(
|
552
|
+
warn(warning)
|
532
553
|
end
|
533
554
|
end
|
534
555
|
|
data/lib/lhs/config.rb
CHANGED
@@ -5,7 +5,7 @@ require 'singleton'
|
|
5
5
|
class LHS::Config
|
6
6
|
include Singleton
|
7
7
|
|
8
|
-
attr_accessor :request_cycle_cache_enabled, :request_cycle_cache, :trace
|
8
|
+
attr_accessor :request_cycle_cache_enabled, :request_cycle_cache, :trace, :auto_oauth
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
self.request_cycle_cache_enabled ||= true
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
module LHS
|
6
|
+
module Interceptors
|
7
|
+
module AutoOauth
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
class Interceptor < LHC::Interceptor
|
11
|
+
|
12
|
+
def before_request
|
13
|
+
request.options[:auth] = { bearer: token }
|
14
|
+
end
|
15
|
+
|
16
|
+
def tokens
|
17
|
+
@tokens ||= LHS::Interceptors::AutoOauth::ThreadRegistry.access_token
|
18
|
+
end
|
19
|
+
|
20
|
+
def token
|
21
|
+
if tokens.is_a?(Hash)
|
22
|
+
tokens.dig(
|
23
|
+
request.options[:oauth] ||
|
24
|
+
request.options[:record]&.auto_oauth
|
25
|
+
)
|
26
|
+
else
|
27
|
+
tokens
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/per_thread_registry'
|
5
|
+
|
6
|
+
module LHS
|
7
|
+
module Interceptors
|
8
|
+
module AutoOauth
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
class ThreadRegistry
|
11
|
+
# Using ActiveSupports PerThreadRegistry to be able to support Active Support v4.
|
12
|
+
# Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4.
|
13
|
+
extend ActiveSupport::PerThreadRegistry
|
14
|
+
attr_accessor :access_token
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/lhs/version.rb
CHANGED
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
describe 'Auto OAuth Authentication', type: :request, dummy_models: true do
|
6
|
+
|
7
|
+
context 'without LHC::Auth interceptor enabled' do
|
8
|
+
|
9
|
+
before do
|
10
|
+
LHS.configure do |config|
|
11
|
+
config.auto_oauth = -> { access_token }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'shows a warning that it can not perform auto authentication' do
|
16
|
+
expect(lambda do
|
17
|
+
get '/automatic_authentication/oauth'
|
18
|
+
end).to output(
|
19
|
+
%r{\[WARNING\] Can't enable auto oauth as LHC::Auth interceptor is not enabled\/configured \(see https://github.com/local-ch/lhc/blob/master/README.md#authentication-interceptor\)!}
|
20
|
+
).to_stderr
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with LHC::Auth interceptor enabled' do
|
25
|
+
|
26
|
+
context 'with only one auth provider' do
|
27
|
+
|
28
|
+
let(:token) { ApplicationController::ACCESS_TOKEN }
|
29
|
+
|
30
|
+
let(:record_request) do
|
31
|
+
stub_request(:get, "http://datastore/v2/records_with_oauth/1")
|
32
|
+
.with(
|
33
|
+
headers: { 'Authorization' => "Bearer #{token}" }
|
34
|
+
).to_return(status: 200, body: { name: 'Record' }.to_json)
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:records_request) do
|
38
|
+
stub_request(:get, "http://datastore/v2/records_with_oauth?color=blue")
|
39
|
+
.with(
|
40
|
+
headers: { 'Authorization' => "Bearer #{token}" }
|
41
|
+
).to_return(status: 200, body: { items: [{ name: 'Record' }] }.to_json)
|
42
|
+
end
|
43
|
+
|
44
|
+
before do
|
45
|
+
LHS.configure do |config|
|
46
|
+
config.auto_oauth = -> { access_token }
|
47
|
+
end
|
48
|
+
LHC.configure do |config|
|
49
|
+
config.interceptors = [LHC::Auth]
|
50
|
+
end
|
51
|
+
record_request
|
52
|
+
records_request
|
53
|
+
end
|
54
|
+
|
55
|
+
after do
|
56
|
+
LHC.config.reset
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'applies OAuth credentials for the individual request automatically' do
|
60
|
+
get '/automatic_authentication/oauth'
|
61
|
+
expect(record_request).to have_been_requested
|
62
|
+
expect(records_request).to have_been_requested
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'with multiple auth providers' do
|
67
|
+
|
68
|
+
before do
|
69
|
+
LHS.configure do |config|
|
70
|
+
config.auto_oauth = proc do
|
71
|
+
{
|
72
|
+
provider1: access_token_provider_1,
|
73
|
+
provider2: access_token_provider_2
|
74
|
+
}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
LHC.configure do |config|
|
78
|
+
config.interceptors = [LHC::Auth]
|
79
|
+
end
|
80
|
+
record_request_provider_1
|
81
|
+
records_request_provider_2
|
82
|
+
records_request_per_endpoint_provider_1
|
83
|
+
record_request_per_endpoint_provider_2
|
84
|
+
end
|
85
|
+
|
86
|
+
let(:token) { ApplicationController::ACCESS_TOKEN }
|
87
|
+
|
88
|
+
let(:record_request_provider_1) do
|
89
|
+
stub_request(:get, "http://datastore/v2/records_with_multiple_oauth_providers_1/1")
|
90
|
+
.with(
|
91
|
+
headers: { 'Authorization' => "Bearer #{token}_provider_1" }
|
92
|
+
).to_return(status: 200, body: { name: 'Record' }.to_json)
|
93
|
+
end
|
94
|
+
|
95
|
+
let(:records_request_provider_2) do
|
96
|
+
stub_request(:get, "http://datastore/v2/records_with_multiple_oauth_providers_2?color=blue")
|
97
|
+
.with(
|
98
|
+
headers: { 'Authorization' => "Bearer #{token}_provider_2" }
|
99
|
+
).to_return(status: 200, body: { items: [{ name: 'Record' }] }.to_json)
|
100
|
+
end
|
101
|
+
|
102
|
+
let(:records_request_per_endpoint_provider_1) do
|
103
|
+
stub_request(:get, "http://datastore/v2/records_with_multiple_oauth_providers_per_endpoint?color=blue")
|
104
|
+
.with(
|
105
|
+
headers: { 'Authorization' => "Bearer #{token}_provider_1" }
|
106
|
+
).to_return(status: 200, body: { items: [{ name: 'Record' }] }.to_json)
|
107
|
+
end
|
108
|
+
|
109
|
+
let(:record_request_per_endpoint_provider_2) do
|
110
|
+
stub_request(:get, "http://datastore/v2/records_with_multiple_oauth_providers_per_endpoint/1")
|
111
|
+
.with(
|
112
|
+
headers: { 'Authorization' => "Bearer #{token}_provider_2" }
|
113
|
+
).to_return(status: 200, body: { name: 'Record' }.to_json)
|
114
|
+
end
|
115
|
+
|
116
|
+
after do
|
117
|
+
LHC.config.reset
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'applies OAuth credentials for the individual request automatically no matter how many auth providers are configured ' do
|
121
|
+
get '/automatic_authentication/oauth_with_multiple_providers'
|
122
|
+
expect(record_request_provider_1).to have_been_requested
|
123
|
+
expect(records_request_provider_2).to have_been_requested
|
124
|
+
expect(records_request_per_endpoint_provider_1).to have_been_requested
|
125
|
+
expect(record_request_per_endpoint_provider_2).to have_been_requested
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'with provider enabled for auto oauth' do
|
130
|
+
|
131
|
+
let(:token) { ApplicationController::ACCESS_TOKEN }
|
132
|
+
|
133
|
+
let(:record_request) do
|
134
|
+
stub_request(:get, "http://internalservice/v2/records/1")
|
135
|
+
.with(
|
136
|
+
headers: { 'Authorization' => "Bearer #{token}" }
|
137
|
+
).to_return(status: 200, body: { name: 'Record' }.to_json)
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:records_request) do
|
141
|
+
stub_request(:get, "http://internalservice/v2/records?color=blue")
|
142
|
+
.with(
|
143
|
+
headers: { 'Authorization' => "Bearer #{token}" }
|
144
|
+
).to_return(status: 200, body: { items: [{ name: 'Record' }] }.to_json)
|
145
|
+
end
|
146
|
+
|
147
|
+
before do
|
148
|
+
LHS.configure do |config|
|
149
|
+
config.auto_oauth = -> { access_token }
|
150
|
+
end
|
151
|
+
LHC.configure do |config|
|
152
|
+
config.interceptors = [LHC::Auth]
|
153
|
+
end
|
154
|
+
record_request
|
155
|
+
records_request
|
156
|
+
end
|
157
|
+
|
158
|
+
after do
|
159
|
+
LHC.config.reset
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'applies OAuth credentials for the individual request automatically' do
|
163
|
+
get '/automatic_authentication/oauth_with_provider'
|
164
|
+
expect(record_request).to have_been_requested
|
165
|
+
expect(records_request).to have_been_requested
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class ApplicationController < ActionController::Base
|
4
|
+
include LHS::OAuth
|
5
|
+
ACCESS_TOKEN = 'token-12345'
|
6
|
+
|
4
7
|
# Prevent CSRF attacks by raising an exception.
|
5
8
|
# For APIs, you may want to use :null_session instead.
|
6
9
|
protect_from_forgery with: :exception
|
@@ -8,4 +11,16 @@ class ApplicationController < ActionController::Base
|
|
8
11
|
def root
|
9
12
|
render nothing: true
|
10
13
|
end
|
14
|
+
|
15
|
+
def access_token
|
16
|
+
ACCESS_TOKEN
|
17
|
+
end
|
18
|
+
|
19
|
+
def access_token_provider_1
|
20
|
+
"#{ACCESS_TOKEN}_provider_1"
|
21
|
+
end
|
22
|
+
|
23
|
+
def access_token_provider_2
|
24
|
+
"#{ACCESS_TOKEN}_provider_2"
|
25
|
+
end
|
11
26
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AutomaticAuthenticationController < ApplicationController
|
4
|
+
|
5
|
+
def o_auth
|
6
|
+
render json: {
|
7
|
+
record: DummyRecordWithOauth.find(1).as_json,
|
8
|
+
records: DummyRecordWithOauth.where(color: 'blue').as_json
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def o_auth_with_multiple_providers
|
13
|
+
render json: {
|
14
|
+
record: DummyRecordWithMultipleOauthProviders1.find(1).as_json,
|
15
|
+
records: DummyRecordWithMultipleOauthProviders2.where(color: 'blue').as_json,
|
16
|
+
per_endpoint: {
|
17
|
+
record: DummyRecordWithMultipleOauthProvidersPerEndpoint.find(1).as_json,
|
18
|
+
records: DummyRecordWithMultipleOauthProvidersPerEndpoint.where(color: 'blue').as_json
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def o_auth_with_provider
|
24
|
+
render json: {
|
25
|
+
record: DummyRecordWithAutoOauthProvider.find(1).as_json,
|
26
|
+
records: DummyRecordWithAutoOauthProvider.where(color: 'blue').as_json
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DummyRecordWithMultipleOauthProviders1 < LHS::Record
|
4
|
+
oauth(:provider1)
|
5
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_1'
|
6
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_1/{id}'
|
7
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DummyRecordWithMultipleOauthProviders2 < LHS::Record
|
4
|
+
oauth(:provider2)
|
5
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_2'
|
6
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_2/{id}'
|
7
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DummyRecordWithMultipleOauthProvidersPerEndpoint < LHS::Record
|
4
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_per_endpoint', oauth: :provider1
|
5
|
+
endpoint 'http://datastore/v2/records_with_multiple_oauth_providers_per_endpoint/{id}', oauth: :provider2
|
6
|
+
end
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
Rails.application.routes.draw do
|
4
4
|
root 'application#root'
|
5
5
|
|
6
|
+
# Automatic Authentication
|
7
|
+
get 'automatic_authentication/oauth' => 'automatic_authentication#o_auth'
|
8
|
+
get 'automatic_authentication/oauth_with_multiple_providers' => 'automatic_authentication#o_auth_with_multiple_providers'
|
9
|
+
get 'automatic_authentication/oauth_with_provider' => 'automatic_authentication#o_auth_with_provider'
|
10
|
+
|
6
11
|
# Request Cycle Cache
|
7
12
|
get 'request_cycle_cache/simple' => 'request_cycle_cache#simple'
|
8
13
|
get 'request_cycle_cache/no_caching_interceptor' => 'request_cycle_cache#no_caching_interceptor'
|
@@ -705,4 +705,23 @@ describe LHS::Record do
|
|
705
705
|
}).not_to raise_exception
|
706
706
|
end
|
707
707
|
end
|
708
|
+
|
709
|
+
context 'include partially empty structures' do
|
710
|
+
before do
|
711
|
+
class Place < LHS::Record
|
712
|
+
endpoint 'https://places/{id}'
|
713
|
+
end
|
714
|
+
stub_request(:get, "https://places/1")
|
715
|
+
.to_return(body: {
|
716
|
+
id: '123',
|
717
|
+
customer: {}
|
718
|
+
}.to_json)
|
719
|
+
end
|
720
|
+
|
721
|
+
it 'skips includes when there is nothing and also does not raise an exception' do
|
722
|
+
expect(-> {
|
723
|
+
Place.includes(customer: :salesforce).find(1)
|
724
|
+
}).not_to raise_exception
|
725
|
+
end
|
726
|
+
end
|
708
727
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rails_helper'
|
4
|
-
require 'lhc/
|
4
|
+
require 'lhc/rspec'
|
5
5
|
|
6
6
|
describe 'Request Cycle Cache', type: :request do
|
7
7
|
let!(:request) do
|
@@ -37,7 +37,7 @@ describe 'Request Cycle Cache', type: :request do
|
|
37
37
|
expect(lambda do
|
38
38
|
get '/request_cycle_cache/no_caching_interceptor'
|
39
39
|
end).to output(
|
40
|
-
%r{\[WARNING\] Can't enable request cycle cache as LHC::Caching interceptor is not enabled/configured \(see https://github.com/local-ch/lhc/blob/master/
|
40
|
+
%r{\[WARNING\] Can't enable request cycle cache as LHC::Caching interceptor is not enabled/configured \(see https://github.com/local-ch/lhc/blob/master/README.md#caching-interceptor\)!}
|
41
41
|
).to_stderr
|
42
42
|
expect(request).to have_been_made.times(2)
|
43
43
|
end
|
@@ -70,7 +70,7 @@ describe 'Request Cycle Cache', type: :request do
|
|
70
70
|
expect(lambda do
|
71
71
|
get '/request_cycle_cache/no_caching_interceptor'
|
72
72
|
end).not_to output(
|
73
|
-
%r{\[WARNING\] Can't enable request cycle cache as LHC::Caching interceptor is not enabled/configured \(see https://github.com/local-ch/lhc/blob/master/
|
73
|
+
%r{\[WARNING\] Can't enable request cycle cache as LHC::Caching interceptor is not enabled/configured \(see https://github.com/local-ch/lhc/blob/master/README.md#caching-interceptor\)!}
|
74
74
|
).to_stderr
|
75
75
|
expect(request).to have_been_made.times(2)
|
76
76
|
end
|
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: 21.
|
4
|
+
version: 21.3.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: 2020-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -146,16 +146,16 @@ dependencies:
|
|
146
146
|
name: rollbar
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- - "
|
149
|
+
- - "<="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
151
|
+
version: 2.24.0
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - "
|
156
|
+
- - "<="
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
158
|
+
version: 2.24.0
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: rspec-rails
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,6 +283,7 @@ files:
|
|
283
283
|
- lib/lhs/concerns/item/save.rb
|
284
284
|
- lib/lhs/concerns/item/update.rb
|
285
285
|
- lib/lhs/concerns/item/validation.rb
|
286
|
+
- lib/lhs/concerns/o_auth.rb
|
286
287
|
- lib/lhs/concerns/option_blocks.rb
|
287
288
|
- lib/lhs/concerns/proxy/accessors.rb
|
288
289
|
- lib/lhs/concerns/proxy/create.rb
|
@@ -314,6 +315,8 @@ files:
|
|
314
315
|
- lib/lhs/config.rb
|
315
316
|
- lib/lhs/data.rb
|
316
317
|
- lib/lhs/endpoint.rb
|
318
|
+
- lib/lhs/interceptors/auto_oauth/interceptor.rb
|
319
|
+
- lib/lhs/interceptors/auto_oauth/thread_registry.rb
|
317
320
|
- lib/lhs/interceptors/extended_rollbar/handler.rb
|
318
321
|
- lib/lhs/interceptors/extended_rollbar/interceptor.rb
|
319
322
|
- lib/lhs/interceptors/extended_rollbar/thread_registry.rb
|
@@ -340,6 +343,7 @@ files:
|
|
340
343
|
- lib/lhs/version.rb
|
341
344
|
- script/ci/build.sh
|
342
345
|
- spec/.DS_Store
|
346
|
+
- spec/auto_oauth_spec.rb
|
343
347
|
- spec/autoloading_spec.rb
|
344
348
|
- spec/collection/accessors_spec.rb
|
345
349
|
- spec/collection/collection_items_spec.rb
|
@@ -372,6 +376,7 @@ files:
|
|
372
376
|
- spec/dummy/app/assets/javascripts/application.js
|
373
377
|
- spec/dummy/app/assets/stylesheets/application.css
|
374
378
|
- spec/dummy/app/controllers/application_controller.rb
|
379
|
+
- spec/dummy/app/controllers/automatic_authentication_controller.rb
|
375
380
|
- spec/dummy/app/controllers/concerns/.keep
|
376
381
|
- spec/dummy/app/controllers/error_handling_with_chains_controller.rb
|
377
382
|
- spec/dummy/app/controllers/extended_rollbar_controller.rb
|
@@ -383,8 +388,14 @@ files:
|
|
383
388
|
- spec/dummy/app/models/concerns/.keep
|
384
389
|
- spec/dummy/app/models/dummy_customer.rb
|
385
390
|
- spec/dummy/app/models/dummy_record.rb
|
391
|
+
- spec/dummy/app/models/dummy_record_with_auto_oauth_provider.rb
|
392
|
+
- spec/dummy/app/models/dummy_record_with_multiple_oauth_providers1.rb
|
393
|
+
- spec/dummy/app/models/dummy_record_with_multiple_oauth_providers2.rb
|
394
|
+
- spec/dummy/app/models/dummy_record_with_multiple_providers_per_endpoint.rb
|
395
|
+
- spec/dummy/app/models/dummy_record_with_oauth.rb
|
386
396
|
- spec/dummy/app/models/dummy_user.rb
|
387
397
|
- spec/dummy/app/models/providers/customer_system.rb
|
398
|
+
- spec/dummy/app/models/providers/internal_services.rb
|
388
399
|
- spec/dummy/app/views/error_handling_with_chains/error.html.erb
|
389
400
|
- spec/dummy/app/views/error_handling_with_chains/show.html.erb
|
390
401
|
- spec/dummy/app/views/form_for.html.erb
|
@@ -548,9 +559,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
548
559
|
version: 2.3.0
|
549
560
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
550
561
|
requirements:
|
551
|
-
- - "
|
562
|
+
- - ">="
|
552
563
|
- !ruby/object:Gem::Version
|
553
|
-
version:
|
564
|
+
version: '0'
|
554
565
|
requirements:
|
555
566
|
- Ruby >= 2.3.0
|
556
567
|
rubygems_version: 3.0.6
|
@@ -559,6 +570,7 @@ specification_version: 4
|
|
559
570
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|
560
571
|
interface for http (hypermedia) json services'
|
561
572
|
test_files:
|
573
|
+
- spec/auto_oauth_spec.rb
|
562
574
|
- spec/autoloading_spec.rb
|
563
575
|
- spec/collection/accessors_spec.rb
|
564
576
|
- spec/collection/collection_items_spec.rb
|
@@ -591,6 +603,7 @@ test_files:
|
|
591
603
|
- spec/dummy/app/assets/javascripts/application.js
|
592
604
|
- spec/dummy/app/assets/stylesheets/application.css
|
593
605
|
- spec/dummy/app/controllers/application_controller.rb
|
606
|
+
- spec/dummy/app/controllers/automatic_authentication_controller.rb
|
594
607
|
- spec/dummy/app/controllers/concerns/.keep
|
595
608
|
- spec/dummy/app/controllers/error_handling_with_chains_controller.rb
|
596
609
|
- spec/dummy/app/controllers/extended_rollbar_controller.rb
|
@@ -602,8 +615,14 @@ test_files:
|
|
602
615
|
- spec/dummy/app/models/concerns/.keep
|
603
616
|
- spec/dummy/app/models/dummy_customer.rb
|
604
617
|
- spec/dummy/app/models/dummy_record.rb
|
618
|
+
- spec/dummy/app/models/dummy_record_with_auto_oauth_provider.rb
|
619
|
+
- spec/dummy/app/models/dummy_record_with_multiple_oauth_providers1.rb
|
620
|
+
- spec/dummy/app/models/dummy_record_with_multiple_oauth_providers2.rb
|
621
|
+
- spec/dummy/app/models/dummy_record_with_multiple_providers_per_endpoint.rb
|
622
|
+
- spec/dummy/app/models/dummy_record_with_oauth.rb
|
605
623
|
- spec/dummy/app/models/dummy_user.rb
|
606
624
|
- spec/dummy/app/models/providers/customer_system.rb
|
625
|
+
- spec/dummy/app/models/providers/internal_services.rb
|
607
626
|
- spec/dummy/app/views/error_handling_with_chains/error.html.erb
|
608
627
|
- spec/dummy/app/views/error_handling_with_chains/show.html.erb
|
609
628
|
- spec/dummy/app/views/form_for.html.erb
|