rename jwtRefresh into jwksRefresh (#4515)
Some checks are pending
code_lint / golangci_lint (push) Waiting to run
code_lint / mod_tidy (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run

This commit is contained in:
Alessandro Ros 2025-05-10 21:14:20 +02:00 committed by GitHub
parent d3976fbc15
commit c8348db52d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ const (
// PauseAfterError is the pause to apply after an authentication failure.
PauseAfterError = 2 * time.Second
jwtRefreshPeriod = 60 * 60 * time.Second
jwksRefreshPeriod = 60 * 60 * time.Second
)
// Error is a authentication error.
@ -79,9 +79,9 @@ type Manager struct {
JWTExclude []conf.AuthInternalUserPermission
ReadTimeout time.Duration
mutex sync.RWMutex
jwtLastRefresh time.Time
jwtKeyFunc keyfunc.Keyfunc
mutex sync.RWMutex
jwksLastRefresh time.Time
jwtKeyFunc keyfunc.Keyfunc
}
// ReloadInternalUsers reloads InternalUsers.
@ -237,7 +237,7 @@ func (m *Manager) pullJWTJWKS() (jwt.Keyfunc, error) {
m.mutex.Lock()
defer m.mutex.Unlock()
if now.Sub(m.jwtLastRefresh) >= jwtRefreshPeriod {
if now.Sub(m.jwksLastRefresh) >= jwksRefreshPeriod {
tr := &http.Transport{
TLSClientConfig: tls.ConfigForFingerprint(m.JWTJWKSFingerprint),
}
@ -266,7 +266,7 @@ func (m *Manager) pullJWTJWKS() (jwt.Keyfunc, error) {
}
m.jwtKeyFunc = tmp
m.jwtLastRefresh = now
m.jwksLastRefresh = now
}
return m.jwtKeyFunc.Keyfunc, nil
@ -277,5 +277,5 @@ func (m *Manager) RefreshJWTJWKS() {
m.mutex.Lock()
defer m.mutex.Unlock()
m.jwtLastRefresh = time.Time{}
m.jwksLastRefresh = time.Time{}
}