mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
tier: Allow edit of the new Azure and AWS auth params (#18690)
Allow editing for the service principal credentials from Azure and the web identity token for AWS; Also, more validation of input parameters.
This commit is contained in:
28
cmd/tier.go
28
cmd/tier.go
@@ -311,22 +311,30 @@ func (config *TierConfigMgr) Edit(ctx context.Context, tierName string, creds ma
|
||||
cfg := config.Tiers[tierName]
|
||||
switch tierType {
|
||||
case madmin.S3:
|
||||
if (creds.AccessKey == "" || creds.SecretKey == "") && !creds.AWSRole {
|
||||
return errTierMissingCredentials
|
||||
}
|
||||
switch {
|
||||
case creds.AWSRole:
|
||||
if creds.AWSRole {
|
||||
cfg.S3.AWSRole = true
|
||||
default:
|
||||
}
|
||||
if creds.AWSRoleWebIdentityTokenFile != "" && creds.AWSRoleARN != "" {
|
||||
cfg.S3.AWSRoleARN = creds.AWSRoleARN
|
||||
cfg.S3.AWSRoleWebIdentityTokenFile = creds.AWSRoleWebIdentityTokenFile
|
||||
}
|
||||
if creds.AccessKey != "" && creds.SecretKey != "" {
|
||||
cfg.S3.AccessKey = creds.AccessKey
|
||||
cfg.S3.SecretKey = creds.SecretKey
|
||||
}
|
||||
case madmin.Azure:
|
||||
if creds.SecretKey == "" {
|
||||
return errTierMissingCredentials
|
||||
if creds.SecretKey != "" {
|
||||
cfg.Azure.AccountKey = creds.SecretKey
|
||||
}
|
||||
if creds.AzSP.TenantID != "" {
|
||||
cfg.Azure.SPAuth.TenantID = creds.AzSP.TenantID
|
||||
}
|
||||
if creds.AzSP.ClientID != "" {
|
||||
cfg.Azure.SPAuth.ClientID = creds.AzSP.ClientID
|
||||
}
|
||||
if creds.AzSP.ClientSecret != "" {
|
||||
cfg.Azure.SPAuth.ClientSecret = creds.AzSP.ClientSecret
|
||||
}
|
||||
cfg.Azure.AccountKey = creds.SecretKey
|
||||
|
||||
case madmin.GCS:
|
||||
if creds.CredsJSON == nil {
|
||||
return errTierMissingCredentials
|
||||
|
||||
Reference in New Issue
Block a user