MachineAuthAPIKey -> SystemUserAPIKey (#3672)

* split machineauthapikey and systemuserapikey

Signed-off-by: jkoberg <jkoberg@owncloud.com>

* changelog

Signed-off-by: jkoberg <jkoberg@owncloud.com>

* specific errors and some reverts

Signed-off-by: jkoberg <jkoberg@owncloud.com>

* use correct machine auth api key

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
kobergj
2022-05-04 15:48:02 +02:00
committed by GitHub
co-authored by Jörn Friedrich Dreyer
parent 2bd63509e3
commit eb59d2291e
18 changed files with 61 additions and 35 deletions
+3 -3
View File
@@ -39,7 +39,7 @@ type Metadata struct {
GatewayAddress string `yaml:"gateway_addr" env:"STORAGE_GATEWAY_GRPC_ADDR"`
StorageAddress string `yaml:"storage_addr" env:"STORAGE_GRPC_ADDR"`
ServiceUserID string `yaml:"service_user_id" env:"METADATA_SERVICE_USER_UUID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"METADATA_SERVICE_USER_IDP"`
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
ServiceUserID string `yaml:"service_user_id" env:"METADATA_SERVICE_USER_UUID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"METADATA_SERVICE_USER_IDP"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY"`
}
@@ -89,8 +89,8 @@ func EnsureDefaults(cfg *config.Config) {
cfg.TokenManager = &config.TokenManager{}
}
if cfg.Metadata.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.Metadata.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
if cfg.Metadata.SystemUserAPIKey == "" && cfg.Commons != nil && cfg.Commons.SystemUserAPIKey != "" {
cfg.Metadata.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey
}
if cfg.Metadata.ServiceUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
@@ -37,8 +37,8 @@ func Validate(cfg *config.Config) error {
return shared.MissingJWTTokenError(cfg.Service.Name)
}
if cfg.Metadata.MachineAuthAPIKey == "" {
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
if cfg.Metadata.SystemUserAPIKey == "" {
return shared.MissingSystemUserApiKeyError(cfg.Service.Name)
}
if cfg.AdminUserID == "" {