Class: Soar::Authorization::AccessManager::Test::OrchestrationProvider::Policy
- Inherits:
-
Object
- Object
- Soar::Authorization::AccessManager::Test::OrchestrationProvider::Policy
- Defined in:
- lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb
Instance Method Summary collapse
- #authorized ⇒ Object
- #authorized? ⇒ Boolean
- #deny_access ⇒ Object
- #grant_access ⇒ Object
-
#initialize ⇒ Policy
constructor
for a specific path and service I want to tell the access manager to query a specific url and paramaters for a policy service_identifier = service_name in router resource_identifier = path in router.
- #no_policy ⇒ Object
- #notification ⇒ Object
Constructor Details
#initialize ⇒ Policy
for a specific path and service I want to tell the access manager to query a specific url and paramaters for a policy service_identifier = service_name in router resource_identifier = path in router
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 19 def initialize policy_host = ENV['POLICY_HOST'] || 'localhost:8080' @meta = { 'service_identifier1' => 'allow_policy', 'service_identifier2' => 'deny_policy' } @policies = { 'allow_policy' => "http://#{policy_host}/allow", 'deny_policy' => "http://#{policy_host}/deny" } @request = { authentication_identifier: 'authentication_identifier1', params: {}, } @resource_identifier = 'resource_identifier1' end |
Instance Method Details
#authorized ⇒ Object
58 59 60 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 58 def @response['data']['approved'] end |
#authorized? ⇒ Boolean
52 53 54 55 56 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 52 def provider = Soar::Authorization::AccessManager::Provider::Policy.new(meta: @meta, policies: @policies ) model = Soar::Authorization::AccessManager.new(provider) @response = model.(service_identifier: @service_identifier, resource_identifier: @resource_identifier, request: @request) end |
#deny_access ⇒ Object
40 41 42 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 40 def deny_access @service_identifier = 'service_identifier2' end |
#grant_access ⇒ Object
36 37 38 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 36 def grant_access @service_identifier = 'service_identifier1' end |
#no_policy ⇒ Object
44 45 46 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 44 def no_policy @service_identifier = 'service_identifier3' end |
#notification ⇒ Object
48 49 50 |
# File 'lib/soar/authorization/access_manager/test/orchestration_provider/policy.rb', line 48 def notification @response['data']['notifications'] end |