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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e19f8ff5ea2367c50d62b815bf735ca92fa57a77
4
- data.tar.gz: 63b4834c6f23a14963736b766d6c521af1ee93a0
3
+ metadata.gz: e236305e861b7e6dc65fd24d2f0ab120e09f365b
4
+ data.tar.gz: d953c9d855b614487f1b0f01df268e6de6216f04
5
5
  SHA512:
6
- metadata.gz: 3c0d0887c51d13b26ac3c69ef2cb3fc0dfcd8130a75bcc80f1c2161051cc90c0c17548714a9ecc0fb91999138142925cc83dcd8f4535999faaeb72e08eea4c39
7
- data.tar.gz: ef95c4d1d4d1db4949f14004172332551b432a6292e8965de03dd6be7d194518fc90a278121c29261c6e5282d2ddf75c812ffa9250c0117024bc3b68d23ef3e7
6
+ metadata.gz: 9197178c6c7492fbd50307c6a2c5a72b8a396b35e617135d2baf63964e5c6bebd10fef5cdbfc46a103eaabf11cc19ad0bb7eee95e796dc66fa88499088715281
7
+ data.tar.gz: 69f8076d07ac6726025b0fea3153f0e3bc5dfe37f24aa3a19da79b3b10bcae1d8b5388ad2c4bb85f9684647d6d3e5a7840a571f7511e7139204b0e5bc362d2d3
@@ -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 access_manager.authorized?(service_identifier, request.path, request)
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
@@ -1,3 +1,3 @@
1
1
  module SoarAuthorization
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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.0"
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.2
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-19 00:00:00.000000000 Z
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.0
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.0
46
+ version: 0.1.2
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement