Class: Soar::Policy::AccessManager::Test::OrchestrationProvider::ServiceRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb

Defined Under Namespace

Classes: Services, Stub

Instance Method Summary collapse

Constructor Details

#initializeServiceRegistry

Returns a new instance of ServiceRegistry.



63
64
65
66
67
68
69
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 63

def initialize
  @resource_identifier = 'resource_identifier1'
  @request = {
    params: {},
    authentication_identifier: 'authentication_identifier1'
  }
end

Instance Method Details

#authorizedObject



94
95
96
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 94

def authorized
  @response['data']['approved']
end

#authorized?Boolean

Returns:

  • (Boolean)


87
88
89
90
91
92
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 87

def authorized?
  service_registry = Stub.new(Services.new)
  model_provider = Soar::Policy::AccessManager::ModelProvider::ServiceRegistry.new(service_registry)
  model = Soar::Policy::AccessManager::Model.new(model_provider)
  @response = model.authorized?(service_identifier: @service_identifier, resource_identifier: @resource_identifier, request: @request)
end

#deny_accessObject



75
76
77
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 75

def deny_access
  @service_identifier = 'service_identifier2'
end

#grant_accessObject



71
72
73
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 71

def grant_access
  @service_identifier = 'service_identifier1'
end

#no_policyObject



79
80
81
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 79

def no_policy
  @service_identifier = 'service_identifier3'
end

#notificationObject



83
84
85
# File 'lib/soar/policy/access_manager/test/orchestration_provider/service_registry.rb', line 83

def notification
  @response['data']['notifications']
end