Sha256: b7d14e14d2e4e202e89e1a7c4213659ea03eb3c6b0154194f915e535b8b50bb7

Contents?: true

Size: 1.33 KB

Versions: 21

Compression:

Stored size: 1.33 KB

Contents

require "pact_broker/config/runtime_configuration_logging_methods"
require "pact_broker/string_refinements"

module PactBroker
  module Config
    module RuntimeConfigurationBasicAuthMethods
      using PactBroker::StringRefinements

      def self.included(anyway_config)
        anyway_config.class_eval do
          attr_config(
            basic_auth_enabled: false,
            basic_auth_username: nil,
            basic_auth_password: nil,
            basic_auth_read_only_username: nil,
            basic_auth_read_only_password: nil,
            allow_public_read: false,
            public_heartbeat: false
          )

          sensitive_values(:basic_auth_password, :basic_auth_read_only_password)

          coerce_types(
            basic_auth_username: :string,
            basic_auth_password: :string,
            basic_auth_read_only_username: :string,
            basic_auth_read_only_password: :string
          )

          def basic_auth_credentials_provided?
            basic_auth_username&.not_blank? && basic_auth_password&.not_blank?
          end

          def basic_auth_write_credentials
            [basic_auth_username, basic_auth_password]
          end

          def basic_auth_read_credentials
            [basic_auth_read_only_username, basic_auth_read_only_password]
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.111.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.109.1 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.109.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.108.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.107.1 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.107.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.106.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.105.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.104.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.103.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.102.2 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.102.1 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.102.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.101.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.100.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.99.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.98.0 lib/pact_broker/config/basic_auth_configuration.rb
pact_broker-2.97.0 lib/pact_broker/config/basic_auth_configuration.rb