castle-rb 3.1.0 → 3.2.0
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 +4 -4
- data/lib/castle/client.rb +1 -1
- data/lib/castle/failover_auth_response.rb +4 -4
- data/lib/castle/version.rb +1 -1
- data/spec/lib/castle/client_spec.rb +14 -14
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a15270851803a5228a22931ccea95fc873bab7e1
|
4
|
+
data.tar.gz: 03741fc4fda242401a8e33e3ffab915e59ef0809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b1cb4d6eeee9fff4d11f51f2fd6a2ed4f562a44754355d041653b4730fe99e07883d3759f14ec40e6923f94be2325c537a69d8aa37be25e372ca857657f219
|
7
|
+
data.tar.gz: '089bd3ca463c5fccd1e62f7669fb18933e39bd83de93ad02c2a2bbe154a71135a488a33965b7a0184a9eaff5ce18e0434ee415192fad0aced90889ec8c0b716a'
|
data/lib/castle/client.rb
CHANGED
@@ -27,7 +27,7 @@ module Castle
|
|
27
27
|
if tracked?
|
28
28
|
command = Castle::Commands::Authenticate.new(@context).build(options)
|
29
29
|
begin
|
30
|
-
@api.request(command).merge(
|
30
|
+
@api.request(command).merge(failover: false, failover_reason: nil)
|
31
31
|
rescue Castle::RequestError, Castle::InternalServerError => error
|
32
32
|
failover_response_or_raise(FailoverAuthResponse.new(options[:user_id], reason: error.to_s), error)
|
33
33
|
end
|
@@ -11,10 +11,10 @@ module Castle
|
|
11
11
|
|
12
12
|
def generate
|
13
13
|
{
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
action: @strategy.to_s,
|
15
|
+
user_id: @user_id,
|
16
|
+
failover: true,
|
17
|
+
failover_reason: @reason
|
18
18
|
}
|
19
19
|
end
|
20
20
|
end
|
data/lib/castle/version.rb
CHANGED
@@ -104,8 +104,8 @@ describe Castle::Client do
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
it { expect(request_response[
|
108
|
-
it { expect(request_response[
|
107
|
+
it { expect(request_response[:failover]).to be false }
|
108
|
+
it { expect(request_response[:failover_reason]).to be_nil }
|
109
109
|
end
|
110
110
|
|
111
111
|
context 'tracking disabled' do
|
@@ -115,10 +115,10 @@ describe Castle::Client do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it { assert_not_requested :post, 'https://api.castle.io/v1/authenticate' }
|
118
|
-
it { expect(request_response[
|
119
|
-
it { expect(request_response[
|
120
|
-
it { expect(request_response[
|
121
|
-
it { expect(request_response[
|
118
|
+
it { expect(request_response[:action]).to be_eql('allow') }
|
119
|
+
it { expect(request_response[:user_id]).to be_eql('1234') }
|
120
|
+
it { expect(request_response[:failover]).to be true }
|
121
|
+
it { expect(request_response[:failover_reason]).to be_eql('Castle set to do not track.') }
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'when request with fail' do
|
@@ -132,10 +132,10 @@ describe Castle::Client do
|
|
132
132
|
|
133
133
|
context 'with request error and not throw on eg deny strategy' do
|
134
134
|
it { assert_not_requested :post, 'https://:secret@api.castle.io/v1/authenticate' }
|
135
|
-
it { expect(request_response[
|
136
|
-
it { expect(request_response[
|
137
|
-
it { expect(request_response[
|
138
|
-
it { expect(request_response[
|
135
|
+
it { expect(request_response[:action]).to be_eql('allow') }
|
136
|
+
it { expect(request_response[:user_id]).to be_eql('1234') }
|
137
|
+
it { expect(request_response[:failover]).to be true }
|
138
|
+
it { expect(request_response[:failover_reason]).to be_eql('Castle::RequestError') }
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -150,10 +150,10 @@ describe Castle::Client do
|
|
150
150
|
|
151
151
|
context 'not throw on eg deny strategy' do
|
152
152
|
it { assert_not_requested :post, 'https://:secret@api.castle.io/v1/authenticate' }
|
153
|
-
it { expect(request_response[
|
154
|
-
it { expect(request_response[
|
155
|
-
it { expect(request_response[
|
156
|
-
it { expect(request_response[
|
153
|
+
it { expect(request_response[:action]).to be_eql('allow') }
|
154
|
+
it { expect(request_response[:user_id]).to be_eql('1234') }
|
155
|
+
it { expect(request_response[:failover]).to be true }
|
156
|
+
it { expect(request_response[:failover_reason]).to be_eql('Castle::InternalServerError') }
|
157
157
|
end
|
158
158
|
end
|
159
159
|
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: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Castle protects your users from account compromise
|
14
14
|
email: johan@castle.io
|
@@ -92,32 +92,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.6.
|
95
|
+
rubygems_version: 2.6.13
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Castle
|
99
99
|
test_files:
|
100
|
-
- spec/spec_helper.rb
|
101
|
-
- spec/lib/castle_spec.rb
|
102
|
-
- spec/lib/castle/review_spec.rb
|
103
|
-
- spec/lib/castle/client_spec.rb
|
104
100
|
- spec/lib/castle/api_spec.rb
|
105
|
-
- spec/lib/castle/
|
106
|
-
- spec/lib/castle/version_spec.rb
|
107
|
-
- spec/lib/castle/default_context_spec.rb
|
108
|
-
- spec/lib/castle/header_formatter_spec.rb
|
109
|
-
- spec/lib/castle/utils/cloner_spec.rb
|
110
|
-
- spec/lib/castle/utils/merger_spec.rb
|
101
|
+
- spec/lib/castle/client_spec.rb
|
111
102
|
- spec/lib/castle/command_spec.rb
|
112
|
-
- spec/lib/castle/request_spec.rb
|
113
|
-
- spec/lib/castle/response_spec.rb
|
114
|
-
- spec/lib/castle/commands/review_spec.rb
|
115
103
|
- spec/lib/castle/commands/authenticate_spec.rb
|
116
|
-
- spec/lib/castle/commands/track_spec.rb
|
117
104
|
- spec/lib/castle/commands/identify_spec.rb
|
105
|
+
- spec/lib/castle/commands/review_spec.rb
|
106
|
+
- spec/lib/castle/commands/track_spec.rb
|
107
|
+
- spec/lib/castle/configuration_spec.rb
|
118
108
|
- spec/lib/castle/context_merger_spec.rb
|
119
|
-
- spec/lib/castle/
|
120
|
-
- spec/lib/castle/extractors/headers_spec.rb
|
109
|
+
- spec/lib/castle/default_context_spec.rb
|
121
110
|
- spec/lib/castle/extractors/client_id_spec.rb
|
122
|
-
- spec/lib/castle/
|
111
|
+
- spec/lib/castle/extractors/headers_spec.rb
|
112
|
+
- spec/lib/castle/extractors/ip_spec.rb
|
113
|
+
- spec/lib/castle/header_formatter_spec.rb
|
114
|
+
- spec/lib/castle/request_spec.rb
|
115
|
+
- spec/lib/castle/response_spec.rb
|
116
|
+
- spec/lib/castle/review_spec.rb
|
123
117
|
- spec/lib/castle/secure_mode_spec.rb
|
118
|
+
- spec/lib/castle/utils/cloner_spec.rb
|
119
|
+
- spec/lib/castle/utils/merger_spec.rb
|
120
|
+
- spec/lib/castle/utils_spec.rb
|
121
|
+
- spec/lib/castle/version_spec.rb
|
122
|
+
- spec/lib/castle_spec.rb
|
123
|
+
- spec/spec_helper.rb
|