castle-rb 7.1.0 → 7.1.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: 1194491c10ae0be7d9dbb1a0ed8c2d86765c84ff21750db3c4a991bacde13155
4
- data.tar.gz: efbe4311bab7d72428fd18e648d25c27fea5a528ea422ae9766a223500523404
3
+ metadata.gz: 774cdc6663639d2a96b9a9a0010bc34bea827edd6b7a42d2f72bb87f94573026
4
+ data.tar.gz: ab2d684474508d1e20fce26dabe1f7594cf255b8682e8b3b1d9b52289d5bab39
5
5
  SHA512:
6
- metadata.gz: 3cea34bb26091eea34a91e9ec240863cca2c199926f40af0312ca2548dbd3ed2848a8812ae4d080641a275d541cd9d1a150ee4b9efb0697407e11f254c77412c
7
- data.tar.gz: 61ce4a2b5041efd6518367ae18eb0c064b7cfb928c2458ea125183467522d10c4f45f4b85012c586125da221f03d9c8ac5cc338ded7d00bf839f6880e6c522cc
6
+ metadata.gz: 9810ca259c0e26cf3195c8ddc1ca1409256011a89584585dd806ddd6b98efac526de25371b33a7cd122a08f271b0d99c61fe68a8da53714483e85fdc065367db
7
+ data.tar.gz: c89c84e1748f1c8bf06e480d5273bfa8c5003da08b01b74f40d588fc1b0567d3828ea4e0b277d3526fe9a179836e5d86606cd88723cd5e70ecb40b23b925e1f5
@@ -11,7 +11,17 @@ module Castle
11
11
  end
12
12
 
13
13
  def call
14
- { action: @strategy.to_s, user_id: @user_id, failover: true, failover_reason: @reason }
14
+ {
15
+ # v1/risk v1/filter structure
16
+ policy: {
17
+ action: @strategy.to_s
18
+ },
19
+ # v1/authenticate structure
20
+ action: @strategy.to_s,
21
+ user_id: @user_id,
22
+ failover: true,
23
+ failover_reason: @reason
24
+ }
15
25
  end
16
26
  end
17
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Castle
4
- VERSION = '7.1.0'
4
+ VERSION = '7.1.1'
5
5
  end
@@ -225,6 +225,7 @@ describe Castle::Client do
225
225
  end
226
226
 
227
227
  it { assert_not_requested :post, 'https://api.castle.io/v1/authenticate' }
228
+ it { expect(request_response[:policy][:action]).to be_eql(Castle::Verdict::ALLOW) }
228
229
  it { expect(request_response[:action]).to be_eql(Castle::Verdict::ALLOW) }
229
230
  it { expect(request_response[:user_id]).to be_eql('1234') }
230
231
  it { expect(request_response[:failover]).to be true }
@@ -246,6 +247,7 @@ describe Castle::Client do
246
247
 
247
248
  context 'with request error and not throw on eg deny strategy' do
248
249
  it { assert_not_requested :post, 'https://:secret@api.castle.io/v1/authenticate' }
250
+ it { expect(request_response[:policy][:action]).to be_eql('allow') }
249
251
  it { expect(request_response[:action]).to be_eql('allow') }
250
252
  it { expect(request_response[:user_id]).to be_eql('1234') }
251
253
  it { expect(request_response[:failover]).to be true }
@@ -266,6 +268,7 @@ describe Castle::Client do
266
268
 
267
269
  describe 'not throw on eg deny strategy' do
268
270
  it { assert_not_requested :post, 'https://:secret@api.castle.io/v1/authenticate' }
271
+ it { expect(request_response[:policy][:action]).to be_eql('allow') }
269
272
  it { expect(request_response[:action]).to be_eql('allow') }
270
273
  it { expect(request_response[:user_id]).to be_eql('1234') }
271
274
  it { expect(request_response[:failover]).to be true }
@@ -104,6 +104,7 @@ RSpec.shared_examples_for 'action request' do |action|
104
104
  end
105
105
 
106
106
  it { assert_not_requested :post, "https://api.castle.io/v1/#{action}" }
107
+ it { expect(request_response[:policy][:action]).to be_eql(Castle::Verdict::ALLOW) }
107
108
  it { expect(request_response[:action]).to be_eql(Castle::Verdict::ALLOW) }
108
109
  it { expect(request_response[:user_id]).to be_eql('1234') }
109
110
  it { expect(request_response[:failover]).to be true }
@@ -125,6 +126,7 @@ RSpec.shared_examples_for 'action request' do |action|
125
126
 
126
127
  context 'with request error and not throw on eg deny strategy' do
127
128
  it { assert_not_requested :post, "https:/:secret@api.castle.io/v1/#{action}" }
129
+ it { expect(request_response[:policy][:action]).to be_eql('allow') }
128
130
  it { expect(request_response[:action]).to be_eql('allow') }
129
131
  it { expect(request_response[:user_id]).to be_eql('1234') }
130
132
  it { expect(request_response[:failover]).to be true }
@@ -143,6 +145,7 @@ RSpec.shared_examples_for 'action request' do |action|
143
145
 
144
146
  describe 'not throw on eg deny strategy' do
145
147
  it { assert_not_requested :post, "https:/:secret@api.castle.io/v1/#{action}" }
148
+ it { expect(request_response[:policy][:action]).to be_eql('allow') }
146
149
  it { expect(request_response[:action]).to be_eql('allow') }
147
150
  it { expect(request_response[:user_id]).to be_eql('1234') }
148
151
  it { expect(request_response[:failover]).to be true }
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: 7.1.0
4
+ version: 7.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Brissmyr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal