Sha256: 6984303bf5b6ea61c53ff7439371a5b287e8a5fa3c69db403d102d78a44fc9c2
Contents?: true
Size: 803 Bytes
Versions: 13
Compression:
Stored size: 803 Bytes
Contents
module Certmeister module Policy def self.validate_authenticate_signature(policy) policy and policy.respond_to?(:authenticate) and policy.method(:authenticate).arity == 1 end def self.validate_authenticate_returns_response(policy) response = policy.authenticate({}) response.respond_to?(:authenticated?) and response.respond_to?(:error) end def self.validate_policies(policies) unless policies.is_a?(Enumerable) and policies.respond_to?(:size) and policies.size > 0 and policies.all? { |policy| self.validate_authenticate_signature(policy) } raise ArgumentError.new("enumerable collection of policies required") end end end end Dir.glob(File.join(File.dirname(__FILE__), "policy", "*.rb")) do |path| require path end
Version data entries
13 entries across 13 versions & 1 rubygems