9
10
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
|
# File 'lib/pact_broker/config/basic_auth_configuration.rb', line 9
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
|