Allow different HTTP basic auth settings per tenant

This commit is contained in:
Javi Martín
2022-09-29 23:07:28 +02:00
parent 18f1d5c1a3
commit a3be1e174b
2 changed files with 9 additions and 8 deletions

View File

@@ -26,12 +26,13 @@ class ApplicationController < ActionController::Base
def authenticate_http_basic def authenticate_http_basic
authenticate_or_request_with_http_basic do |username, password| authenticate_or_request_with_http_basic do |username, password|
username == Rails.application.secrets.http_basic_username && password == Rails.application.secrets.http_basic_password username == Tenant.current_secrets.http_basic_username &&
password == Tenant.current_secrets.http_basic_password
end end
end end
def http_basic_auth_site? def http_basic_auth_site?
Rails.application.secrets.http_basic_auth Tenant.current_secrets.http_basic_auth
end end
def verify_lock def verify_lock

View File

@@ -57,8 +57,8 @@ staging:
# my_tenant_subdomain: # my_tenant_subdomain:
# secret_key: my_secret_value # secret_key: my_secret_value
# #
# Currently you can overwrite SMTP, SMS, manager and microsoft API # Currently you can overwrite SMTP, SMS, manager, microsoft API and
# settings. # HTTP basic settings.
<<: *maps <<: *maps
<<: *apis <<: *apis
@@ -93,8 +93,8 @@ preproduction:
# my_tenant_subdomain: # my_tenant_subdomain:
# secret_key: my_secret_value # secret_key: my_secret_value
# #
# Currently you can overwrite SMTP, SMS, manager and microsoft API # Currently you can overwrite SMTP, SMS, manager, microsoft API and
# settings. # HTTP basic settings.
twitter_key: "" twitter_key: ""
twitter_secret: "" twitter_secret: ""
facebook_key: "" facebook_key: ""
@@ -134,8 +134,8 @@ production:
# my_tenant_subdomain: # my_tenant_subdomain:
# secret_key: my_secret_value # secret_key: my_secret_value
# #
# Currently you can overwrite SMTP, SMS, manager and microsoft API # Currently you can overwrite SMTP, SMS, manager, microsoft API and
# settings. # HTTP basic settings.
twitter_key: "" twitter_key: ""
twitter_secret: "" twitter_secret: ""
facebook_key: "" facebook_key: ""