mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-30 15:02:00 -08:00
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
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:
parent
d3976fbc15
commit
c8348db52d
1 changed files with 7 additions and 7 deletions
|
|
@ -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{}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue