reuse sha256 in config GetSettings (#16188)

This commit is contained in:
jiuker
2022-12-08 19:03:24 +08:00
committed by GitHub
parent ebe395788b
commit 8edc2faaa9

View File

@@ -506,14 +506,13 @@ func (r *Config) GetSettings() madmin.OpenIDSettings {
if !r.Enabled { if !r.Enabled {
return res return res
} }
h := sha256.New()
for arn, provCfg := range r.arnProviderCfgsMap { for arn, provCfg := range r.arnProviderCfgsMap {
hashedSecret := "" hashedSecret := ""
{ {
h := sha256.New() h.Reset()
h.Write([]byte(provCfg.ClientSecret)) h.Write([]byte(provCfg.ClientSecret))
bs := h.Sum(nil) hashedSecret = base64.RawURLEncoding.EncodeToString(h.Sum(nil))
hashedSecret = base64.RawURLEncoding.EncodeToString(bs)
} }
if arn != DummyRoleARN { if arn != DummyRoleARN {
if res.Roles == nil { if res.Roles == nil {