-
Notifications
You must be signed in to change notification settings - Fork 2
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
Bugfix/66602 keycloak access token is not refreshing properly #286
base: main
Are you sure you want to change the base?
Bugfix/66602 keycloak access token is not refreshing properly #286
Conversation
…StorageKey enum. added TokenRefreshingHttpClient in order to implement access/refresh token cycle.
…systeme/AW40-hub-docker into bugfix/66602_keycloak_access_token_is_not_refreshing_properly
String? token = await _authProvider.getAccessToken(); | ||
if (token == null) { | ||
await _authProvider.refreshAccessToken(); | ||
token = await _authProvider.getAccessToken(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kinda works.
Every first request after the token expires still contains the outdated token and fails.
I think it might be because it reads the new token with getAccessToken right after refreshAccessToken. refreshAccessToken writes the token into the storageService but unawaited so there might be a race condition where the old token is read from storage while the write operation of the new token has not finished?
); | ||
|
||
@override | ||
Future<http.StreamedResponse> send(http.BaseRequest request) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overwriting the send method seems a bit to broad to me. It works but it would leak the token to other web endpoints the webui interacts with since the Authorization header will always be set. The usage of the Authorization header should be restricted to the web endpoints that require the header and we trust.
Will this still be addressed before the demonstrations? |
I am working on other stories regarding Pontus-X currently. As soon as I'm done with that, I'll take care of this. Otherwise I am very happy about any support. Be it through concrete suggestions on how to implement it better. I admit my solution is rather "quick and dirty" due to the time constraints we face regarding the deadline. |
…systeme/AW40-hub-docker into bugfix/66602_keycloak_access_token_is_not_refreshing_properly
No description provided.