From 07b358c3b4f214c7286b17ed0022595b63a92b21 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Mon, 21 Mar 2022 17:14:22 +0100 Subject: [PATCH] allow disable basic auth --- terraform/auth/auth.go | 4 ++++ terraform/storage/storage.go | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/terraform/auth/auth.go b/terraform/auth/auth.go index 92c6736..916268e 100644 --- a/terraform/auth/auth.go +++ b/terraform/auth/auth.go @@ -24,6 +24,10 @@ func Authenticate(req *http.Request, s *terraform.State) (ok bool, err error) { var authenticator Authenticator switch backend { case "basic": + viper.SetDefault("auth_basic_enabled", true) + if !viper.GetBool("auth_basic_enabled") { + return false, fmt.Errorf("basic auth is not enabled") + } authenticator = basic.NewBasicAuth() case "jwt": issuerURL := viper.GetString("auth_jwt_oidc_issuer_url") diff --git a/terraform/storage/storage.go b/terraform/storage/storage.go index fcc87b1..00461b1 100644 --- a/terraform/storage/storage.go +++ b/terraform/storage/storage.go @@ -26,8 +26,6 @@ func GetStorage() (s Storage, err error) { case "s3": viper.SetDefault("storage_s3_endpoint", "s3.amazonaws.com") viper.SetDefault("storage_s3_use_ssl", true) - viper.SetDefault("storage_s3_access_key", "access-key-id") - viper.SetDefault("storage_s3_secret_key", "secret-access-key") viper.SetDefault("storage_s3_bucket", "terraform-state") endpoint := viper.GetString("storage_s3_endpoint")