Sha256: 442a6aef30c3ecef546b092d21030c6467994e31d0cd0ae860947404ebbef49e

Contents?: true

Size: 840 Bytes

Versions: 10

Compression:

Stored size: 840 Bytes

Contents

# frozen_string_literal: true

class LHC::AuthScrubber < LHC::Scrubber
  def initialize(data)
    super(data)
    scrub_auth_options!
  end

  private

  def scrub_auth_options!
    return if scrubbed.blank?
    return if scrub_auth_elements.blank?

    scrub_basic_auth_options! if scrub_auth_elements.include?(:basic)
    scrub_bearer_auth_options! if scrub_auth_elements.include?(:bearer)
  end

  def scrub_basic_auth_options!
    return if scrubbed[:basic].blank?

    scrubbed[:basic][:username] = SCRUB_DISPLAY
    scrubbed[:basic][:password] = SCRUB_DISPLAY
    scrubbed[:basic][:base_64_encoded_credentials] = SCRUB_DISPLAY
  end

  def scrub_bearer_auth_options!
    return if scrubbed[:bearer].blank?

    scrubbed[:bearer] = SCRUB_DISPLAY if scrubbed[:bearer].is_a?(String)
    scrubbed[:bearer_token] = SCRUB_DISPLAY
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lhc-15.2.1 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.2.0 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.1.3 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.1.2 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.1.1 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.1.0 lib/lhc/scrubbers/auth_scrubber.rb
lhc-16.0.0.pre.pro2162.2 lib/lhc/scrubbers/auth_scrubber.rb
lhc-16.0.0.pre.pro2162 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.0.1 lib/lhc/scrubbers/auth_scrubber.rb
lhc-15.0.0 lib/lhc/scrubbers/auth_scrubber.rb