From 8edc2faaa908c0c60df288ded126d0e18ae6ad5a Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Thu, 8 Dec 2022 19:03:24 +0800 Subject: [PATCH] reuse sha256 in config GetSettings (#16188) --- internal/config/identity/openid/openid.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/config/identity/openid/openid.go b/internal/config/identity/openid/openid.go index 44da71923..3f076af96 100644 --- a/internal/config/identity/openid/openid.go +++ b/internal/config/identity/openid/openid.go @@ -506,14 +506,13 @@ func (r *Config) GetSettings() madmin.OpenIDSettings { if !r.Enabled { return res } - + h := sha256.New() for arn, provCfg := range r.arnProviderCfgsMap { hashedSecret := "" { - h := sha256.New() + h.Reset() h.Write([]byte(provCfg.ClientSecret)) - bs := h.Sum(nil) - hashedSecret = base64.RawURLEncoding.EncodeToString(bs) + hashedSecret = base64.RawURLEncoding.EncodeToString(h.Sum(nil)) } if arn != DummyRoleARN { if res.Roles == nil {