grafana/pkg/infra/serverlock
Dan Cech 9020eb4b17
Auth: Update oauthtoken service to use remote cache and server lock (#90572)
* update oauthtoken service to use remote cache and server lock

* remove token cache

* retry is lock is held by an in-flight refresh

* refactor token renewal to avoid race condition

* re-add refresh token expiry cache, but in SyncOauthTokenHook

* Add delta to the cache ttl

* Fix merge

* Change lockTimeConfig

* Always set the token from within the server lock

* Improvements

* early return when user is not authed by OAuth or refresh is disabled

* Allow more time for token refresh, tracing

* Retry on Mysql Deadlock error 1213

* Update pkg/services/authn/authnimpl/sync/oauth_token_sync.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update pkg/services/authn/authnimpl/sync/oauth_token_sync.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Add settings for configuring min wait time between retries

* Add docs for the new setting

* Clean up

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

---------

Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2024-08-19 18:57:37 +02:00
..
errors.go Chore: Extract server lock error so it can be used with errors.As (#58899) 2022-11-17 15:02:17 +01:00
model.go Backend: Rename variables for style conformance (#29097) 2020-11-17 17:09:14 +01:00
serverlock_integration_test.go AuthN: Support HA setups with External Service Account management (#78425) 2023-11-22 10:15:13 +01:00
serverlock_test.go Chore: Update test database initialization (#81673) 2024-02-09 09:35:39 -05:00
serverlock.go Auth: Update oauthtoken service to use remote cache and server lock (#90572) 2024-08-19 18:57:37 +02:00