castle-rb 4.1.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +158 -43
- data/lib/castle.rb +46 -21
- data/lib/castle/api.rb +24 -12
- data/lib/castle/api/approve_device.rb +25 -0
- data/lib/castle/api/authenticate.rb +34 -0
- data/lib/castle/api/end_impersonation.rb +29 -0
- data/lib/castle/api/get_device.rb +25 -0
- data/lib/castle/api/get_devices_for_user.rb +25 -0
- data/lib/castle/api/identify.rb +26 -0
- data/lib/castle/api/report_device.rb +25 -0
- data/lib/castle/api/review.rb +24 -0
- data/lib/castle/api/start_impersonation.rb +29 -0
- data/lib/castle/api/track.rb +26 -0
- data/lib/castle/client.rb +52 -45
- data/lib/castle/{extractors/client_id.rb → client_id/extract.rb} +2 -2
- data/lib/castle/commands/approve_device.rb +21 -0
- data/lib/castle/commands/authenticate.rb +13 -13
- data/lib/castle/commands/end_impersonation.rb +25 -0
- data/lib/castle/commands/get_device.rb +21 -0
- data/lib/castle/commands/get_devices_for_user.rb +21 -0
- data/lib/castle/commands/identify.rb +12 -13
- data/lib/castle/commands/report_device.rb +21 -0
- data/lib/castle/commands/review.rb +6 -3
- data/lib/castle/commands/start_impersonation.rb +25 -0
- data/lib/castle/commands/track.rb +12 -13
- data/lib/castle/configuration.rb +45 -28
- data/lib/castle/context/{default.rb → get_default.rb} +5 -6
- data/lib/castle/context/{merger.rb → merge.rb} +3 -3
- data/lib/castle/context/prepare.rb +18 -0
- data/lib/castle/context/{sanitizer.rb → sanitize.rb} +1 -1
- data/lib/castle/core/get_connection.rb +25 -0
- data/lib/castle/{api/response.rb → core/process_response.rb} +4 -2
- data/lib/castle/core/process_webhook.rb +20 -0
- data/lib/castle/core/send_request.rb +50 -0
- data/lib/castle/errors.rb +2 -0
- data/lib/castle/events.rb +1 -1
- data/lib/castle/failover/prepare_response.rb +23 -0
- data/lib/castle/failover/strategy.rb +20 -0
- data/lib/castle/headers/extract.rb +47 -0
- data/lib/castle/headers/filter.rb +37 -0
- data/lib/castle/headers/format.rb +24 -0
- data/lib/castle/ip/extract.rb +83 -0
- data/lib/castle/logger.rb +19 -0
- data/lib/castle/payload/prepare.rb +27 -0
- data/lib/castle/secure_mode.rb +6 -2
- data/lib/castle/session.rb +18 -0
- data/lib/castle/singleton_configuration.rb +9 -0
- data/lib/castle/utils/clean_invalid_chars.rb +24 -0
- data/lib/castle/utils/clone.rb +15 -0
- data/lib/castle/utils/deep_symbolize_keys.rb +45 -0
- data/lib/castle/utils/get_timestamp.rb +15 -0
- data/lib/castle/utils/{merger.rb → merge.rb} +3 -3
- data/lib/castle/utils/secure_compare.rb +22 -0
- data/lib/castle/validators/not_supported.rb +1 -0
- data/lib/castle/validators/present.rb +1 -0
- data/lib/castle/verdict.rb +13 -0
- data/lib/castle/version.rb +1 -1
- data/lib/castle/webhooks/verify.rb +43 -0
- data/spec/integration/rails/rails_spec.rb +33 -7
- data/spec/integration/rails/support/application.rb +3 -1
- data/spec/integration/rails/support/home_controller.rb +47 -5
- data/spec/lib/castle/api/approve_device_spec.rb +21 -0
- data/spec/lib/castle/api/authenticate_spec.rb +140 -0
- data/spec/lib/castle/api/end_impersonation_spec.rb +59 -0
- data/spec/lib/castle/api/get_device_spec.rb +19 -0
- data/spec/lib/castle/api/get_devices_for_user_spec.rb +19 -0
- data/spec/lib/castle/api/identify_spec.rb +68 -0
- data/spec/lib/castle/api/report_device_spec.rb +21 -0
- data/spec/lib/castle/{review_spec.rb → api/review_spec.rb} +3 -3
- data/spec/lib/castle/api/start_impersonation_spec.rb +59 -0
- data/spec/lib/castle/api/track_spec.rb +68 -0
- data/spec/lib/castle/api_spec.rb +16 -1
- data/spec/lib/castle/{extractors/client_id_spec.rb → client_id/extract_spec.rb} +2 -2
- data/spec/lib/castle/client_spec.rb +41 -23
- data/spec/lib/castle/commands/approve_device_spec.rb +24 -0
- data/spec/lib/castle/commands/authenticate_spec.rb +7 -16
- data/spec/lib/castle/commands/end_impersonation_spec.rb +82 -0
- data/spec/lib/castle/commands/get_device_spec.rb +24 -0
- data/spec/lib/castle/commands/get_devices_for_user_spec.rb +24 -0
- data/spec/lib/castle/commands/identify_spec.rb +5 -16
- data/spec/lib/castle/commands/report_device_spec.rb +24 -0
- data/spec/lib/castle/commands/review_spec.rb +1 -1
- data/spec/lib/castle/commands/{impersonate_spec.rb → start_impersonation_spec.rb} +9 -34
- data/spec/lib/castle/commands/track_spec.rb +5 -16
- data/spec/lib/castle/configuration_spec.rb +9 -138
- data/spec/lib/castle/context/{default_spec.rb → get_default_spec.rb} +1 -2
- data/spec/lib/castle/context/{merger_spec.rb → merge_spec.rb} +1 -1
- data/spec/lib/castle/context/prepare_spec.rb +44 -0
- data/spec/lib/castle/context/{sanitizer_spec.rb → sanitize_spec.rb} +1 -1
- data/spec/lib/castle/core/get_connection_spec.rb +59 -0
- data/spec/lib/castle/{api/response_spec.rb → core/process_response_spec.rb} +56 -1
- data/spec/lib/castle/core/process_webhook_spec.rb +46 -0
- data/spec/lib/castle/core/send_request_spec.rb +102 -0
- data/spec/lib/castle/failover/strategy_spec.rb +12 -0
- data/spec/lib/castle/{extractors/headers_spec.rb → headers/extract_spec.rb} +18 -18
- data/spec/lib/castle/{headers_filter_spec.rb → headers/filter_spec.rb} +6 -5
- data/spec/lib/castle/headers/format_spec.rb +25 -0
- data/spec/lib/castle/{extractors/ip_spec.rb → ip/extract_spec.rb} +35 -7
- data/spec/lib/castle/logger_spec.rb +42 -0
- data/spec/lib/castle/payload/prepare_spec.rb +54 -0
- data/spec/lib/castle/session_spec.rb +88 -0
- data/spec/lib/castle/singleton_configuration_spec.rb +18 -0
- data/spec/lib/castle/utils/clean_invalid_chars_spec.rb +69 -0
- data/spec/lib/castle/utils/{cloner_spec.rb → clone_spec.rb} +3 -3
- data/spec/lib/castle/utils/deep_symbolize_keys_spec.rb +50 -0
- data/spec/lib/castle/utils/{timestamp_spec.rb → get_timestamp_spec.rb} +1 -1
- data/spec/lib/castle/utils/{merger_spec.rb → merge_spec.rb} +3 -3
- data/spec/lib/castle/verdict_spec.rb +9 -0
- data/spec/lib/castle/webhooks/verify_spec.rb +69 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples/configuration.rb +129 -0
- metadata +133 -56
- data/lib/castle/api/request.rb +0 -42
- data/lib/castle/api/session.rb +0 -39
- data/lib/castle/commands/impersonate.rb +0 -26
- data/lib/castle/extractors/headers.rb +0 -45
- data/lib/castle/extractors/ip.rb +0 -68
- data/lib/castle/failover_auth_response.rb +0 -21
- data/lib/castle/headers_filter.rb +0 -35
- data/lib/castle/headers_formatter.rb +0 -22
- data/lib/castle/review.rb +0 -11
- data/lib/castle/utils.rb +0 -55
- data/lib/castle/utils/cloner.rb +0 -11
- data/lib/castle/utils/timestamp.rb +0 -12
- data/spec/lib/castle/api/request_spec.rb +0 -72
- data/spec/lib/castle/headers_formatter_spec.rb +0 -25
- data/spec/lib/castle/utils_spec.rb +0 -156
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Castle::Utils::CleanInvalidChars do
|
4
|
+
describe '::call' do
|
5
|
+
subject { described_class.call(input) }
|
6
|
+
|
7
|
+
context 'when input is a string' do
|
8
|
+
let(:input) { '1234' }
|
9
|
+
|
10
|
+
it { is_expected.to eq input }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when input is an array' do
|
14
|
+
let(:input) { [1, 2, 3, '4'] }
|
15
|
+
|
16
|
+
it { is_expected.to eq input }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when input is a hash' do
|
20
|
+
let(:input) { { user_id: 1 } }
|
21
|
+
|
22
|
+
it { is_expected.to eq input }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when input is nil' do
|
26
|
+
let(:input) { nil }
|
27
|
+
|
28
|
+
it { is_expected.to eq input }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when input is a nested hash' do
|
32
|
+
let(:input) { { user: { id: 1 } } }
|
33
|
+
|
34
|
+
it { is_expected.to eq input }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with invalid UTF-8 characters' do
|
38
|
+
context 'when input is a hash' do
|
39
|
+
let(:input) { { user_id: "inv\xC4lid" } }
|
40
|
+
|
41
|
+
it { is_expected.to eq(user_id: 'inv�lid') }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when input is a nested hash' do
|
45
|
+
let(:input) { { user: { id: "inv\xC4lid" } } }
|
46
|
+
|
47
|
+
it { is_expected.to eq(user: { id: 'inv�lid' }) }
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when input is an array of hashes' do
|
51
|
+
let(:input) { [{ user: "inv\xC4lid" }] * 2 }
|
52
|
+
|
53
|
+
it { is_expected.to eq([{ user: 'inv�lid' }, { user: 'inv�lid' }]) }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when input is an array' do
|
57
|
+
let(:input) { ["inv\xC4lid"] * 2 }
|
58
|
+
|
59
|
+
it { is_expected.to eq(['inv�lid', 'inv�lid']) }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when input is a hash with array in key' do
|
63
|
+
let(:input) { { items: ["inv\xC4lid"] * 2 } }
|
64
|
+
|
65
|
+
it { is_expected.to eq(items: ['inv�lid', 'inv�lid']) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe Castle::Utils::
|
4
|
-
subject(:
|
3
|
+
describe Castle::Utils::Clone do
|
4
|
+
subject(:clone) { described_class }
|
5
5
|
|
6
6
|
describe 'call' do
|
7
7
|
let(:nested) { { c: '3' } }
|
8
8
|
let(:first) { { test: { test1: { c: '4' }, test2: nested, a: '1', b: '2' } } }
|
9
9
|
let(:result) { { test: { test1: { c: '4' }, test2: { c: '3' }, a: '1', b: '2' } } }
|
10
|
-
let(:cloned) {
|
10
|
+
let(:cloned) { clone.call(first) }
|
11
11
|
|
12
12
|
before { cloned }
|
13
13
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Castle::Utils::DeepSymbolizeKeys do
|
4
|
+
let(:nested_strings) { { 'a' => { 'b' => { 'c' => 3 } } } }
|
5
|
+
let(:nested_symbols) { { a: { b: { c: 3 } } } }
|
6
|
+
let(:nested_mixed) { { 'a' => { b: { 'c' => 3 } } } }
|
7
|
+
let(:string_array_of_hashes) { { 'a' => [{ 'b' => 2 }, { 'c' => 3 }, 4] } }
|
8
|
+
let(:symbol_array_of_hashes) { { a: [{ b: 2 }, { c: 3 }, 4] } }
|
9
|
+
let(:mixed_array_of_hashes) { { a: [{ b: 2 }, { 'c' => 3 }, 4] } }
|
10
|
+
|
11
|
+
describe '::call' do
|
12
|
+
subject { described_class.call(hash) }
|
13
|
+
|
14
|
+
context 'when nested_symbols' do
|
15
|
+
let(:hash) { nested_symbols }
|
16
|
+
|
17
|
+
it { is_expected.to eq(nested_symbols) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when nested_strings' do
|
21
|
+
let(:hash) { nested_strings }
|
22
|
+
|
23
|
+
it { is_expected.to eq(nested_symbols) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when nested_mixed' do
|
27
|
+
let(:hash) { nested_mixed }
|
28
|
+
|
29
|
+
it { is_expected.to eq(nested_symbols) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when string_array_of_hashes' do
|
33
|
+
let(:hash) { string_array_of_hashes }
|
34
|
+
|
35
|
+
it { is_expected.to eq(symbol_array_of_hashes) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when symbol_array_of_hashes' do
|
39
|
+
let(:hash) { symbol_array_of_hashes }
|
40
|
+
|
41
|
+
it { is_expected.to eq(symbol_array_of_hashes) }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when mixed_array_of_hashes' do
|
45
|
+
let(:hash) { mixed_array_of_hashes }
|
46
|
+
|
47
|
+
it { is_expected.to eq(symbol_array_of_hashes) }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe Castle::Utils::
|
4
|
-
subject(:
|
3
|
+
describe Castle::Utils::Merge do
|
4
|
+
subject(:merge) { described_class }
|
5
5
|
|
6
6
|
describe 'call' do
|
7
7
|
let(:first) { { test: { test1: { c: '4' }, test2: { c: '3' }, a: '1', b: '2' } } }
|
8
8
|
let(:second) { { test2: '2', test: { 'test1' => { d: '5' }, test2: '6', a: nil, b: '3' } } }
|
9
9
|
let(:result) { { test2: '2', test: { test1: { c: '4', d: '5' }, test2: '6', b: '3' } } }
|
10
10
|
|
11
|
-
it { expect(
|
11
|
+
it { expect(merge.call(first, second)).to be_eql(result) }
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Castle::Verdict do
|
4
|
+
subject(:verdict) { described_class }
|
5
|
+
|
6
|
+
it { expect(verdict::ALLOW).to be_eql('allow') }
|
7
|
+
it { expect(verdict::DENY).to be_eql('deny') }
|
8
|
+
it { expect(verdict::CHALLENGE).to be_eql('challenge') }
|
9
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Castle::Webhooks::Verify do
|
4
|
+
describe '#call' do
|
5
|
+
subject(:call) { described_class.call(webhook) }
|
6
|
+
|
7
|
+
let(:env) do
|
8
|
+
Rack::MockRequest.env_for(
|
9
|
+
'/',
|
10
|
+
'HTTP_X_CASTLE_SIGNATURE' => signature
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:webhook) { Rack::Request.new(env) }
|
15
|
+
let(:user_id) { '12345' }
|
16
|
+
let(:webhook_body) do
|
17
|
+
{
|
18
|
+
api_version: 'v1',
|
19
|
+
app_id: '12345',
|
20
|
+
type: '$incident.confirmed',
|
21
|
+
created_at: '2020-12-18T12:55:21.779Z',
|
22
|
+
data: {
|
23
|
+
id: 'test',
|
24
|
+
device_token: 'token',
|
25
|
+
user_id: user_id,
|
26
|
+
trigger: '$login.succeeded',
|
27
|
+
context: {},
|
28
|
+
location: {},
|
29
|
+
user_agent: {}
|
30
|
+
},
|
31
|
+
user_traits: {},
|
32
|
+
properties: {},
|
33
|
+
policy: {}
|
34
|
+
}.to_json
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when success' do
|
38
|
+
let(:signature) { '3ptx3rUOBnGEqPjMrbcJn2UUfzwTKP54dFyP5uyPY+Y=' }
|
39
|
+
|
40
|
+
before do
|
41
|
+
allow(Castle::Core::ProcessWebhook)
|
42
|
+
.to receive(:call)
|
43
|
+
.and_return(webhook_body)
|
44
|
+
end
|
45
|
+
|
46
|
+
it do
|
47
|
+
expect { call }.not_to raise_error
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when signature is malformed' do
|
52
|
+
let(:signature) { '123' }
|
53
|
+
|
54
|
+
before do
|
55
|
+
allow(Castle::Core::ProcessWebhook)
|
56
|
+
.to receive(:call)
|
57
|
+
.and_return(webhook_body)
|
58
|
+
end
|
59
|
+
|
60
|
+
it do
|
61
|
+
expect { call }
|
62
|
+
.to raise_error(
|
63
|
+
Castle::WebhookVerificationError,
|
64
|
+
'Signature not matching the expected signature'
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'configuration_host' do
|
4
|
+
describe 'host' do
|
5
|
+
context 'with default' do
|
6
|
+
it { expect(config.base_url.host).to be_eql('api.castle.io') }
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'with setter' do
|
10
|
+
before { config.base_url = 'http://api.castle.dev/v2' }
|
11
|
+
|
12
|
+
it { expect(config.base_url.host).to be_eql('api.castle.dev') }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
shared_examples 'configuration_request_timeout' do
|
18
|
+
describe 'request_timeout' do
|
19
|
+
it do
|
20
|
+
expect(config.request_timeout).to be_eql(1000)
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with setter' do
|
24
|
+
let(:value) { 50.0 }
|
25
|
+
|
26
|
+
before do
|
27
|
+
config.request_timeout = value
|
28
|
+
end
|
29
|
+
|
30
|
+
it do
|
31
|
+
expect(config.request_timeout).to be_eql(value)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
shared_examples 'configuration_allowlisted' do
|
38
|
+
describe 'allowlisted' do
|
39
|
+
it do
|
40
|
+
expect(config.allowlisted.size).to be_eql(0)
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'with setter' do
|
44
|
+
before do
|
45
|
+
config.allowlisted = ['header']
|
46
|
+
end
|
47
|
+
|
48
|
+
it do
|
49
|
+
expect(config.allowlisted).to be_eql(['Header'])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
shared_examples 'configuration_denylisted' do
|
56
|
+
describe 'denylisted' do
|
57
|
+
it do
|
58
|
+
expect(config.denylisted.size).to be_eql(0)
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'with setter' do
|
62
|
+
before do
|
63
|
+
config.denylisted = ['header']
|
64
|
+
end
|
65
|
+
|
66
|
+
it do
|
67
|
+
expect(config.denylisted).to be_eql(['Header'])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
shared_examples 'configuration_failover_strategy' do
|
74
|
+
describe 'failover_strategy' do
|
75
|
+
it do
|
76
|
+
expect(config.failover_strategy).to be_eql(Castle::Failover::Strategy::ALLOW)
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'with setter' do
|
80
|
+
before do
|
81
|
+
config.failover_strategy = Castle::Failover::Strategy::DENY
|
82
|
+
end
|
83
|
+
|
84
|
+
it do
|
85
|
+
expect(config.failover_strategy).to be_eql(Castle::Failover::Strategy::DENY)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when broken' do
|
90
|
+
it do
|
91
|
+
expect do
|
92
|
+
config.failover_strategy = :unicorn
|
93
|
+
end.to raise_error(Castle::ConfigurationError)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
shared_examples 'configuration_api_secret' do
|
100
|
+
describe 'api_secret' do
|
101
|
+
context 'with env' do
|
102
|
+
let(:secret_key_env) { 'secret_key_env' }
|
103
|
+
let(:secret_key) { 'secret_key' }
|
104
|
+
|
105
|
+
before do
|
106
|
+
allow(ENV).to receive(:fetch).with(
|
107
|
+
'CASTLE_API_SECRET', ''
|
108
|
+
).and_return(secret_key_env)
|
109
|
+
config.reset
|
110
|
+
end
|
111
|
+
|
112
|
+
it { expect(config.api_secret).to be_eql(secret_key_env) }
|
113
|
+
|
114
|
+
context 'when key is overwritten' do
|
115
|
+
before { config.api_secret = secret_key }
|
116
|
+
|
117
|
+
it { expect(config.api_secret).to be_eql(secret_key) }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'with setter' do
|
122
|
+
let(:value) { 'new_secret' }
|
123
|
+
|
124
|
+
before { config.api_secret = value }
|
125
|
+
|
126
|
+
it { expect(config.api_secret).to be_eql(value) }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: castle-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -34,81 +34,132 @@ files:
|
|
34
34
|
- lib/castle-rb.rb
|
35
35
|
- lib/castle.rb
|
36
36
|
- lib/castle/api.rb
|
37
|
-
- lib/castle/api/
|
38
|
-
- lib/castle/api/
|
39
|
-
- lib/castle/api/
|
37
|
+
- lib/castle/api/approve_device.rb
|
38
|
+
- lib/castle/api/authenticate.rb
|
39
|
+
- lib/castle/api/end_impersonation.rb
|
40
|
+
- lib/castle/api/get_device.rb
|
41
|
+
- lib/castle/api/get_devices_for_user.rb
|
42
|
+
- lib/castle/api/identify.rb
|
43
|
+
- lib/castle/api/report_device.rb
|
44
|
+
- lib/castle/api/review.rb
|
45
|
+
- lib/castle/api/start_impersonation.rb
|
46
|
+
- lib/castle/api/track.rb
|
40
47
|
- lib/castle/client.rb
|
48
|
+
- lib/castle/client_id/extract.rb
|
41
49
|
- lib/castle/command.rb
|
50
|
+
- lib/castle/commands/approve_device.rb
|
42
51
|
- lib/castle/commands/authenticate.rb
|
52
|
+
- lib/castle/commands/end_impersonation.rb
|
53
|
+
- lib/castle/commands/get_device.rb
|
54
|
+
- lib/castle/commands/get_devices_for_user.rb
|
43
55
|
- lib/castle/commands/identify.rb
|
44
|
-
- lib/castle/commands/
|
56
|
+
- lib/castle/commands/report_device.rb
|
45
57
|
- lib/castle/commands/review.rb
|
58
|
+
- lib/castle/commands/start_impersonation.rb
|
46
59
|
- lib/castle/commands/track.rb
|
47
60
|
- lib/castle/configuration.rb
|
48
|
-
- lib/castle/context/
|
49
|
-
- lib/castle/context/
|
50
|
-
- lib/castle/context/
|
61
|
+
- lib/castle/context/get_default.rb
|
62
|
+
- lib/castle/context/merge.rb
|
63
|
+
- lib/castle/context/prepare.rb
|
64
|
+
- lib/castle/context/sanitize.rb
|
65
|
+
- lib/castle/core/get_connection.rb
|
66
|
+
- lib/castle/core/process_response.rb
|
67
|
+
- lib/castle/core/process_webhook.rb
|
68
|
+
- lib/castle/core/send_request.rb
|
51
69
|
- lib/castle/errors.rb
|
52
70
|
- lib/castle/events.rb
|
53
|
-
- lib/castle/
|
54
|
-
- lib/castle/
|
55
|
-
- lib/castle/
|
56
|
-
- lib/castle/
|
57
|
-
- lib/castle/
|
58
|
-
- lib/castle/
|
59
|
-
- lib/castle/
|
71
|
+
- lib/castle/failover/prepare_response.rb
|
72
|
+
- lib/castle/failover/strategy.rb
|
73
|
+
- lib/castle/headers/extract.rb
|
74
|
+
- lib/castle/headers/filter.rb
|
75
|
+
- lib/castle/headers/format.rb
|
76
|
+
- lib/castle/ip/extract.rb
|
77
|
+
- lib/castle/logger.rb
|
78
|
+
- lib/castle/payload/prepare.rb
|
60
79
|
- lib/castle/secure_mode.rb
|
80
|
+
- lib/castle/session.rb
|
81
|
+
- lib/castle/singleton_configuration.rb
|
61
82
|
- lib/castle/support/hanami.rb
|
62
83
|
- lib/castle/support/padrino.rb
|
63
84
|
- lib/castle/support/rails.rb
|
64
85
|
- lib/castle/support/sinatra.rb
|
65
|
-
- lib/castle/utils.rb
|
66
|
-
- lib/castle/utils/
|
67
|
-
- lib/castle/utils/
|
68
|
-
- lib/castle/utils/
|
86
|
+
- lib/castle/utils/clean_invalid_chars.rb
|
87
|
+
- lib/castle/utils/clone.rb
|
88
|
+
- lib/castle/utils/deep_symbolize_keys.rb
|
89
|
+
- lib/castle/utils/get_timestamp.rb
|
90
|
+
- lib/castle/utils/merge.rb
|
91
|
+
- lib/castle/utils/secure_compare.rb
|
69
92
|
- lib/castle/validators/not_supported.rb
|
70
93
|
- lib/castle/validators/present.rb
|
94
|
+
- lib/castle/verdict.rb
|
71
95
|
- lib/castle/version.rb
|
96
|
+
- lib/castle/webhooks/verify.rb
|
72
97
|
- spec/integration/rails/rails_spec.rb
|
73
98
|
- spec/integration/rails/support/all.rb
|
74
99
|
- spec/integration/rails/support/application.rb
|
75
100
|
- spec/integration/rails/support/home_controller.rb
|
76
|
-
- spec/lib/castle/api/
|
77
|
-
- spec/lib/castle/api/
|
101
|
+
- spec/lib/castle/api/approve_device_spec.rb
|
102
|
+
- spec/lib/castle/api/authenticate_spec.rb
|
103
|
+
- spec/lib/castle/api/end_impersonation_spec.rb
|
104
|
+
- spec/lib/castle/api/get_device_spec.rb
|
105
|
+
- spec/lib/castle/api/get_devices_for_user_spec.rb
|
106
|
+
- spec/lib/castle/api/identify_spec.rb
|
107
|
+
- spec/lib/castle/api/report_device_spec.rb
|
108
|
+
- spec/lib/castle/api/review_spec.rb
|
109
|
+
- spec/lib/castle/api/start_impersonation_spec.rb
|
110
|
+
- spec/lib/castle/api/track_spec.rb
|
78
111
|
- spec/lib/castle/api_spec.rb
|
112
|
+
- spec/lib/castle/client_id/extract_spec.rb
|
79
113
|
- spec/lib/castle/client_spec.rb
|
80
114
|
- spec/lib/castle/command_spec.rb
|
115
|
+
- spec/lib/castle/commands/approve_device_spec.rb
|
81
116
|
- spec/lib/castle/commands/authenticate_spec.rb
|
117
|
+
- spec/lib/castle/commands/end_impersonation_spec.rb
|
118
|
+
- spec/lib/castle/commands/get_device_spec.rb
|
119
|
+
- spec/lib/castle/commands/get_devices_for_user_spec.rb
|
82
120
|
- spec/lib/castle/commands/identify_spec.rb
|
83
|
-
- spec/lib/castle/commands/
|
121
|
+
- spec/lib/castle/commands/report_device_spec.rb
|
84
122
|
- spec/lib/castle/commands/review_spec.rb
|
123
|
+
- spec/lib/castle/commands/start_impersonation_spec.rb
|
85
124
|
- spec/lib/castle/commands/track_spec.rb
|
86
125
|
- spec/lib/castle/configuration_spec.rb
|
87
|
-
- spec/lib/castle/context/
|
88
|
-
- spec/lib/castle/context/
|
89
|
-
- spec/lib/castle/context/
|
126
|
+
- spec/lib/castle/context/get_default_spec.rb
|
127
|
+
- spec/lib/castle/context/merge_spec.rb
|
128
|
+
- spec/lib/castle/context/prepare_spec.rb
|
129
|
+
- spec/lib/castle/context/sanitize_spec.rb
|
130
|
+
- spec/lib/castle/core/get_connection_spec.rb
|
131
|
+
- spec/lib/castle/core/process_response_spec.rb
|
132
|
+
- spec/lib/castle/core/process_webhook_spec.rb
|
133
|
+
- spec/lib/castle/core/send_request_spec.rb
|
90
134
|
- spec/lib/castle/events_spec.rb
|
91
|
-
- spec/lib/castle/
|
92
|
-
- spec/lib/castle/
|
93
|
-
- spec/lib/castle/
|
94
|
-
- spec/lib/castle/
|
95
|
-
- spec/lib/castle/
|
96
|
-
- spec/lib/castle/
|
135
|
+
- spec/lib/castle/failover/strategy_spec.rb
|
136
|
+
- spec/lib/castle/headers/extract_spec.rb
|
137
|
+
- spec/lib/castle/headers/filter_spec.rb
|
138
|
+
- spec/lib/castle/headers/format_spec.rb
|
139
|
+
- spec/lib/castle/ip/extract_spec.rb
|
140
|
+
- spec/lib/castle/logger_spec.rb
|
141
|
+
- spec/lib/castle/payload/prepare_spec.rb
|
97
142
|
- spec/lib/castle/secure_mode_spec.rb
|
98
|
-
- spec/lib/castle/
|
99
|
-
- spec/lib/castle/
|
100
|
-
- spec/lib/castle/utils/
|
101
|
-
- spec/lib/castle/
|
143
|
+
- spec/lib/castle/session_spec.rb
|
144
|
+
- spec/lib/castle/singleton_configuration_spec.rb
|
145
|
+
- spec/lib/castle/utils/clean_invalid_chars_spec.rb
|
146
|
+
- spec/lib/castle/utils/clone_spec.rb
|
147
|
+
- spec/lib/castle/utils/deep_symbolize_keys_spec.rb
|
148
|
+
- spec/lib/castle/utils/get_timestamp_spec.rb
|
149
|
+
- spec/lib/castle/utils/merge_spec.rb
|
102
150
|
- spec/lib/castle/validators/not_supported_spec.rb
|
103
151
|
- spec/lib/castle/validators/present_spec.rb
|
152
|
+
- spec/lib/castle/verdict_spec.rb
|
104
153
|
- spec/lib/castle/version_spec.rb
|
154
|
+
- spec/lib/castle/webhooks/verify_spec.rb
|
105
155
|
- spec/lib/castle_spec.rb
|
106
156
|
- spec/spec_helper.rb
|
157
|
+
- spec/support/shared_examples/configuration.rb
|
107
158
|
homepage: https://castle.io
|
108
159
|
licenses:
|
109
160
|
- MIT
|
110
161
|
metadata: {}
|
111
|
-
post_install_message:
|
162
|
+
post_install_message:
|
112
163
|
rdoc_options: []
|
113
164
|
require_paths:
|
114
165
|
- lib
|
@@ -123,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
174
|
- !ruby/object:Gem::Version
|
124
175
|
version: '0'
|
125
176
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
-
signing_key:
|
177
|
+
rubygems_version: 3.1.3
|
178
|
+
signing_key:
|
128
179
|
specification_version: 4
|
129
180
|
summary: Castle
|
130
181
|
test_files:
|
@@ -133,33 +184,59 @@ test_files:
|
|
133
184
|
- spec/integration/rails/support/all.rb
|
134
185
|
- spec/integration/rails/support/home_controller.rb
|
135
186
|
- spec/integration/rails/rails_spec.rb
|
187
|
+
- spec/support/shared_examples/configuration.rb
|
136
188
|
- spec/lib/castle_spec.rb
|
137
|
-
- spec/lib/castle/
|
138
|
-
- spec/lib/castle/
|
189
|
+
- spec/lib/castle/session_spec.rb
|
190
|
+
- spec/lib/castle/verdict_spec.rb
|
139
191
|
- spec/lib/castle/client_spec.rb
|
140
|
-
- spec/lib/castle/context/
|
141
|
-
- spec/lib/castle/context/
|
142
|
-
- spec/lib/castle/context/
|
192
|
+
- spec/lib/castle/context/get_default_spec.rb
|
193
|
+
- spec/lib/castle/context/prepare_spec.rb
|
194
|
+
- spec/lib/castle/context/sanitize_spec.rb
|
195
|
+
- spec/lib/castle/context/merge_spec.rb
|
196
|
+
- spec/lib/castle/core/get_connection_spec.rb
|
197
|
+
- spec/lib/castle/core/process_webhook_spec.rb
|
198
|
+
- spec/lib/castle/core/send_request_spec.rb
|
199
|
+
- spec/lib/castle/core/process_response_spec.rb
|
143
200
|
- spec/lib/castle/api_spec.rb
|
201
|
+
- spec/lib/castle/logger_spec.rb
|
202
|
+
- spec/lib/castle/client_id/extract_spec.rb
|
144
203
|
- spec/lib/castle/configuration_spec.rb
|
145
204
|
- spec/lib/castle/version_spec.rb
|
146
|
-
- spec/lib/castle/
|
147
|
-
- spec/lib/castle/utils/
|
148
|
-
- spec/lib/castle/utils/
|
205
|
+
- spec/lib/castle/payload/prepare_spec.rb
|
206
|
+
- spec/lib/castle/utils/clean_invalid_chars_spec.rb
|
207
|
+
- spec/lib/castle/utils/deep_symbolize_keys_spec.rb
|
208
|
+
- spec/lib/castle/utils/get_timestamp_spec.rb
|
209
|
+
- spec/lib/castle/utils/clone_spec.rb
|
210
|
+
- spec/lib/castle/utils/merge_spec.rb
|
149
211
|
- spec/lib/castle/command_spec.rb
|
150
|
-
- spec/lib/castle/
|
151
|
-
- spec/lib/castle/
|
152
|
-
- spec/lib/castle/
|
212
|
+
- spec/lib/castle/headers/format_spec.rb
|
213
|
+
- spec/lib/castle/headers/extract_spec.rb
|
214
|
+
- spec/lib/castle/headers/filter_spec.rb
|
215
|
+
- spec/lib/castle/api/review_spec.rb
|
216
|
+
- spec/lib/castle/api/report_device_spec.rb
|
217
|
+
- spec/lib/castle/api/authenticate_spec.rb
|
218
|
+
- spec/lib/castle/api/track_spec.rb
|
219
|
+
- spec/lib/castle/api/get_device_spec.rb
|
220
|
+
- spec/lib/castle/api/start_impersonation_spec.rb
|
221
|
+
- spec/lib/castle/api/approve_device_spec.rb
|
222
|
+
- spec/lib/castle/api/get_devices_for_user_spec.rb
|
223
|
+
- spec/lib/castle/api/end_impersonation_spec.rb
|
224
|
+
- spec/lib/castle/api/identify_spec.rb
|
153
225
|
- spec/lib/castle/commands/review_spec.rb
|
226
|
+
- spec/lib/castle/commands/report_device_spec.rb
|
154
227
|
- spec/lib/castle/commands/authenticate_spec.rb
|
155
228
|
- spec/lib/castle/commands/track_spec.rb
|
156
|
-
- spec/lib/castle/commands/
|
229
|
+
- spec/lib/castle/commands/get_device_spec.rb
|
230
|
+
- spec/lib/castle/commands/start_impersonation_spec.rb
|
231
|
+
- spec/lib/castle/commands/approve_device_spec.rb
|
232
|
+
- spec/lib/castle/commands/get_devices_for_user_spec.rb
|
233
|
+
- spec/lib/castle/commands/end_impersonation_spec.rb
|
157
234
|
- spec/lib/castle/commands/identify_spec.rb
|
158
235
|
- spec/lib/castle/validators/not_supported_spec.rb
|
159
236
|
- spec/lib/castle/validators/present_spec.rb
|
160
|
-
- spec/lib/castle/
|
161
|
-
- spec/lib/castle/
|
162
|
-
- spec/lib/castle/
|
163
|
-
- spec/lib/castle/utils_spec.rb
|
237
|
+
- spec/lib/castle/webhooks/verify_spec.rb
|
238
|
+
- spec/lib/castle/ip/extract_spec.rb
|
239
|
+
- spec/lib/castle/failover/strategy_spec.rb
|
164
240
|
- spec/lib/castle/secure_mode_spec.rb
|
241
|
+
- spec/lib/castle/singleton_configuration_spec.rb
|
165
242
|
- spec/lib/castle/events_spec.rb
|