soar_authorization 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soar_authorization.rb +15 -1
- data/lib/soar_authorization/version.rb +1 -1
- data/soar_authorization.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e236305e861b7e6dc65fd24d2f0ab120e09f365b
|
4
|
+
data.tar.gz: d953c9d855b614487f1b0f01df268e6de6216f04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9197178c6c7492fbd50307c6a2c5a72b8a396b35e617135d2baf63964e5c6bebd10fef5cdbfc46a103eaabf11cc19ad0bb7eee95e796dc66fa88499088715281
|
7
|
+
data.tar.gz: 69f8076d07ac6726025b0fea3153f0e3bc5dfe37f24aa3a19da79b3b10bcae1d8b5388ad2c4bb85f9684647d6d3e5a7840a571f7511e7139204b0e5bc362d2d3
|
data/lib/soar_authorization.rb
CHANGED
@@ -22,10 +22,24 @@ module SoarAuthorization
|
|
22
22
|
entries.each do |entry|
|
23
23
|
service_identifier = entry['service_identifier']
|
24
24
|
access_manager = entry['access_manager']
|
25
|
-
return [403, {"Content-Type" => "text/html"}, [" 403 - Not authorized"]] if not
|
25
|
+
return [403, {"Content-Type" => "text/html"}, [" 403 - Not authorized"]] if not authorized?(env, access_manager, service_identifier, request.path, request)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
@app.call(env)
|
29
29
|
end
|
30
|
+
|
31
|
+
def authorized?(env, access_manager, service_identifier, path, request)
|
32
|
+
return true if ENV['RACK_ENV'] == 'development'
|
33
|
+
begin
|
34
|
+
result = access_manager.authorized?(service_identifier, request.path, request)
|
35
|
+
result['data']['notifications'].each do |notification|
|
36
|
+
env['auditing'].info(notification, request['flow_identifier']) if env['auditing']
|
37
|
+
end
|
38
|
+
result['data']['approved']
|
39
|
+
rescue Exception => ex
|
40
|
+
env['auditing'].error("Exception: #{ex.class}: #{ex.message}:\n\t#{ex.backtrace.join("\n\t")}", request['flow_identifier']) if env['auditing']
|
41
|
+
false
|
42
|
+
end
|
43
|
+
end
|
30
44
|
end
|
31
45
|
end
|
data/soar_authorization.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency "rack", '>= 1.6.4', '< 3.0.0'
|
31
|
-
spec.add_dependency "soar_am", "~> 0.1.
|
31
|
+
spec.add_dependency "soar_am", "~> 0.1.2"
|
32
32
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.12"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst Van Graan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.1.
|
39
|
+
version: 0.1.2
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.1.
|
46
|
+
version: 0.1.2
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|