Class: StandardAudit::Configuration
- Inherits:
-
Object
- Object
- StandardAudit::Configuration
- Defined in:
- lib/standard_audit/configuration.rb
Instance Attribute Summary collapse
-
#actor_extractor ⇒ Object
Returns the value of attribute actor_extractor.
-
#anonymizable_metadata_keys ⇒ Object
Returns the value of attribute anonymizable_metadata_keys.
-
#async ⇒ Object
Returns the value of attribute async.
-
#current_actor_resolver ⇒ Object
Returns the value of attribute current_actor_resolver.
-
#current_ip_address_resolver ⇒ Object
Returns the value of attribute current_ip_address_resolver.
-
#current_request_id_resolver ⇒ Object
Returns the value of attribute current_request_id_resolver.
-
#current_session_id_resolver ⇒ Object
Returns the value of attribute current_session_id_resolver.
-
#current_user_agent_resolver ⇒ Object
Returns the value of attribute current_user_agent_resolver.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#metadata_builder ⇒ Object
Returns the value of attribute metadata_builder.
-
#queue_name ⇒ Object
Returns the value of attribute queue_name.
-
#retention_days ⇒ Object
Returns the value of attribute retention_days.
-
#scope_extractor ⇒ Object
Returns the value of attribute scope_extractor.
-
#sensitive_keys ⇒ Object
Returns the value of attribute sensitive_keys.
-
#target_extractor ⇒ Object
Returns the value of attribute target_extractor.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #subscribe_to(pattern) ⇒ Object
- #subscriptions ⇒ Object
- #use_preset(name) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/standard_audit/configuration.rb', line 11 def initialize @subscriptions = [] @applied_presets = [] @async = false @queue_name = :default @enabled = true @actor_extractor = ->(payload) { payload[:actor] } @target_extractor = ->(payload) { payload[:target] } @scope_extractor = ->(payload) { payload[:scope] } @current_actor_resolver = -> { defined?(Current) && Current.respond_to?(:user) ? Current.user : nil } @current_request_id_resolver = -> { defined?(Current) && Current.respond_to?(:request_id) ? Current.request_id : nil } @current_ip_address_resolver = -> { defined?(Current) && Current.respond_to?(:ip_address) ? Current.ip_address : nil } @current_user_agent_resolver = -> { defined?(Current) && Current.respond_to?(:user_agent) ? Current.user_agent : nil } @current_session_id_resolver = -> { defined?(Current) && Current.respond_to?(:session_id) ? Current.session_id : nil } # Note: :authorization filters the HTTP Authorization header value. # If you use "authorization" as a metadata key for policy decisions, # rename it (e.g. :authorization_policy) to avoid accidental filtering. @sensitive_keys = %i[ password password_confirmation token secret api_key access_token refresh_token private_key certificate_chain ssn credit_card authorization ] @metadata_builder = nil @anonymizable_metadata_keys = %i[email name ip_address] @retention_days = nil end |
Instance Attribute Details
#actor_extractor ⇒ Object
Returns the value of attribute actor_extractor.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def actor_extractor @actor_extractor end |
#anonymizable_metadata_keys ⇒ Object
Returns the value of attribute anonymizable_metadata_keys.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def @anonymizable_metadata_keys end |
#async ⇒ Object
Returns the value of attribute async.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def async @async end |
#current_actor_resolver ⇒ Object
Returns the value of attribute current_actor_resolver.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def current_actor_resolver @current_actor_resolver end |
#current_ip_address_resolver ⇒ Object
Returns the value of attribute current_ip_address_resolver.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def current_ip_address_resolver @current_ip_address_resolver end |
#current_request_id_resolver ⇒ Object
Returns the value of attribute current_request_id_resolver.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def current_request_id_resolver @current_request_id_resolver end |
#current_session_id_resolver ⇒ Object
Returns the value of attribute current_session_id_resolver.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def current_session_id_resolver @current_session_id_resolver end |
#current_user_agent_resolver ⇒ Object
Returns the value of attribute current_user_agent_resolver.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def current_user_agent_resolver @current_user_agent_resolver end |
#enabled ⇒ Object
Returns the value of attribute enabled.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def enabled @enabled end |
#metadata_builder ⇒ Object
Returns the value of attribute metadata_builder.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def @metadata_builder end |
#queue_name ⇒ Object
Returns the value of attribute queue_name.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def queue_name @queue_name end |
#retention_days ⇒ Object
Returns the value of attribute retention_days.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def retention_days @retention_days end |
#scope_extractor ⇒ Object
Returns the value of attribute scope_extractor.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def scope_extractor @scope_extractor end |
#sensitive_keys ⇒ Object
Returns the value of attribute sensitive_keys.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def sensitive_keys @sensitive_keys end |
#target_extractor ⇒ Object
Returns the value of attribute target_extractor.
3 4 5 |
# File 'lib/standard_audit/configuration.rb', line 3 def target_extractor @target_extractor end |
Instance Method Details
#subscribe_to(pattern) ⇒ Object
52 53 54 |
# File 'lib/standard_audit/configuration.rb', line 52 def subscribe_to(pattern) @subscriptions << pattern end |
#subscriptions ⇒ Object
56 57 58 |
# File 'lib/standard_audit/configuration.rb', line 56 def subscriptions @subscriptions.dup.freeze end |
#use_preset(name) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/standard_audit/configuration.rb', line 60 def use_preset(name) key = name.to_sym return self if @applied_presets.include?(key) preset = case key when :standard_id require "standard_audit/presets/standard_id" StandardAudit::Presets::StandardId else raise ArgumentError, "Unknown preset: #{name}. Available presets: :standard_id" end preset.apply(self) @applied_presets << key self end |