Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth token refresh has a race condition #62

Closed
jwulf opened this issue Mar 15, 2024 · 0 comments
Closed

OAuth token refresh has a race condition #62

jwulf opened this issue Mar 15, 2024 · 0 comments
Assignees
Milestone

Comments

@jwulf
Copy link
Member

jwulf commented Mar 15, 2024

Tests in GitHub CI for Self-Managed are failing.

The cause seems to be a race condition in token refresh. At the moment, the OAuth component caches the token and compares the expiry time to the current time, and requests a new token if the expiry time is greater than or equal to the current time.

If the token expires in 1ms it will be used for a call, but this will probably result in it expiring before it hits the service.

To deal with this, I am adding a new configuration field: CAMUNDA_OAUTH_TOKEN_REFRESH_THRESHOLD_MS. It defaults to 1000 (1 second).

This represents the lead time to refresh the token. So, by default a cached token will be refreshed 1 second before it expires, and this can be tuned by the user depending on their environment.

@jwulf jwulf self-assigned this Mar 15, 2024
@jwulf jwulf added this to the 8.5.0 milestone Mar 15, 2024
@jwulf jwulf closed this as completed in 5c2e53e Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant