Optimization: reuse hashedSecret when LookupConfig (#19724)

This commit is contained in:
jiuker 2024-05-13 13:52:27 +08:00 committed by GitHub
parent 074d70112d
commit 01bfc78535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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