class Soar::Authorization::AccessManager::Provider::Stub
Public Class Methods
new(meta: {}, policies: {})
click to toggle source
@param [Hash] meta mapping service identifiers to policy identifiers @param [Hash] policies, policy identifiers map to resource identifiers, that map to an array of authentication_identifiers that are allowed access
# File lib/soar/authorization/access_manager/provider/stub.rb, line 15 def initialize(meta: {}, policies: {}) @meta = meta @policies = policies end
Public Instance Methods
Private Instance Methods
ask_policy(policy, authentication_identifier, service_identifier, resource_identifier, params)
click to toggle source
@param [String] policy @param [String] authentication_identifier @param [String] service_identifier @param [String] resource_identifier @param [Hash] request @return [Bool] result @return [Array] notifications
# File lib/soar/authorization/access_manager/provider/stub.rb, line 77 def ask_policy(policy, authentication_identifier, service_identifier, resource_identifier, params) notifications = [] result = @policies[policy][resource_identifier].include?(authentication_identifier) if not result notifications << 'Policy query result was not success' return false, notifications end return result, notifications rescue => ex notifications << "Exception while asking policy #{ex.message}" return false, notifications end
get_meta(service_identifier)
click to toggle source
@param [String] service identifier @return [Hash, nil] policy hash or nil
# File lib/soar/authorization/access_manager/provider/stub.rb, line 64 def get_meta(service_identifier) @meta[service_identifier] end