authbox 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/authbox.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddf5c8f090baec72a6aa598fbb2e4598ec1bd238
|
4
|
+
data.tar.gz: 5648ec3da5624749cdcb19cef90449361d227410
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d349e8cf24f32a879603858da81e19654b96d7fd6f172115d48ae65b3c3de8f8d4c2d374a6a2a2b9c0a2fbbb7f37b3614ad7f7bd5aae608bf6eb02fc95949fe
|
7
|
+
data.tar.gz: ffbaa80f215f50e92d415db7f9d67b1ad94c656f4ac72ba838882e9b1ceef186411607c4ae5e452138121706c62c8ed7de89106feb42bad963eff0c28f0bea8d
|
data/lib/authbox.rb
CHANGED
@@ -53,9 +53,9 @@ module Authbox
|
|
53
53
|
# Report a custom action to Authbox.
|
54
54
|
# If this is not called during a request, an $unknown action
|
55
55
|
# will be logged. See the documentation for what information
|
56
|
-
# you can pass here in the
|
57
|
-
def authbox_log(
|
58
|
-
return authbox_request(
|
56
|
+
# you can pass here in the action hash.
|
57
|
+
def authbox_log(action={})
|
58
|
+
return authbox_request(action, true)
|
59
59
|
end
|
60
60
|
|
61
61
|
##
|
@@ -100,7 +100,7 @@ module Authbox
|
|
100
100
|
return Rails.configuration.authbox[:endpoint] || 'https://api.authbox.io/api'
|
101
101
|
end
|
102
102
|
|
103
|
-
def authbox_request(
|
103
|
+
def authbox_request(action, async)
|
104
104
|
if @authbox_requested
|
105
105
|
logger.warn 'authbox_log() already called'
|
106
106
|
return
|
@@ -140,7 +140,7 @@ module Authbox
|
|
140
140
|
}
|
141
141
|
|
142
142
|
body.merge!(authbox_get_request_data())
|
143
|
-
body.merge!(
|
143
|
+
body.merge!(action)
|
144
144
|
|
145
145
|
base_uri = authbox_get_endpoint()
|
146
146
|
uri = URI(base_uri + '/action')
|
@@ -155,7 +155,10 @@ module Authbox
|
|
155
155
|
response = authbox_post_form(uri, body)
|
156
156
|
|
157
157
|
begin
|
158
|
-
|
158
|
+
parsed_response = JSON.parse(response.body)
|
159
|
+
if not parsed_response.has_key? 'type'
|
160
|
+
return {'type' => 'ALLOW', 'info' => 'No verdict returend'}
|
161
|
+
end
|
159
162
|
rescue => e
|
160
163
|
logger.warn "AUTHBOX: Error decoding body: #{e}"
|
161
164
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Authbox, Inc.
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.4.3
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Authbox
|