# SoarAuditingProvider This gem provides the auditing API that audit providers for the SOAR architecture should adhere to. Providers are initialized with a list of auditors and their configuration, as well as the NFRs they support, and is responsible for selecting an auditor giving a set of NFRs, and configuring the auditor appropriately. The auditing API as set out below then delegates auditing actions to the selected auditor. The API provides default delegation behaviour that calls the API methods verbatim on the auditor. ## Installation Add this line to your application's Gemfile: ```ruby gem 'soar_auditing_provider' ``` And then execute: $ bundle Or install it yourself as: $ gem install soar_auditing_provider ## Usage Extend the SoarAuditingProvider::AuditingProviderAPI to create an auditing provider: ``` class MyAuditingProvider < SoarAuditingProvider::AuditingProviderAPI end ``` Provide the required inversion of control method to configure (an) injected auditor(s): ``` def configure_auditor(configuration = nil) @auditor.configure(configuration) end ``` Initialize the provider so: ``` auditor = MyAuditor.new auditor_configuration = { 'nfrs' => { 'nfr' => 'description' }, 'some' => 'configuration' } @iut = MyAuditingProvider.new(auditor, auditor_configuration) ``` Audit using the API methods, e.g.: ``` @iut.info("This is info") @iut.debug(some_debug_object) @iut.warn("Statistics show that dropped packets have increased to #{dropped}%") @iut.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate") @iut.fatal("Unable to perform action, too many dropped packets. Functional degradation.") @iut << 'Rack::CommonLogger requires this' ``` The API also supports appending as below, enabling support, e.g. for Rack::CommonLogger, etc.: ``` << ``` ## Detailed example ``` require 'log4r' require 'soar_auditing_provider' class Log4rAuditingProvider < SoarAuditingProvider::AuditingProviderAPI def configure_auditor(configuration = nil) @auditor.outputters = configuration['outputter'] end end class Main include Log4r def test_sanity auditor = Logger.new 'sanity' auditor_configuration = { 'nfrs' => { 'accessibility' => 'local' }, 'outputter' => Outputter.stdout } provider = Log4rAuditingProvider.new(auditor, auditor_configuration) @iut = provider.create('') some_debug_object = 123 @iut.info("This is info") @iut.debug(some_debug_object) dropped = 95 @iut.warn("Statistics show that dropped packets have increased to #{dropped}%") @iut.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate") @iut.fatal("Unable to perform action, too many dropped packets. Functional degradation.") end end main = Main.new main.test_sanity ``` ## Contributing Bug reports and feature requests are welcome by email to ernst dot van dot graan at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za) ## Notes Though out of scope for the provider, auditors should take into account encoding, serialization, and other NFRs. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).