[feature][websocket] Enforce access token expiration #24563
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes that the expiration time of an access token is ignored for Websocket connections.
PIP: 292
Motivation
When a client connects via Websockets and uses a token as authentication mechanism, the validity of the token is only checked when the connection is established. When the expiry time of the token has passed, the client remains connected.
This is insecure, and makes the websocket implementation unsuitable for a use case where the enforcement of the token expiry time is important.
Modifications
From a user perspective, a few changes are noticable:
The core code modification is made in AbstractWebSocketHandler.java
Modifications for requesting and receiving a new access token from the client:
A function in AuthenticationService.java has been added to query the configured authentication providers to keep the support for multiple authentication providers.
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: Topsector-Logistiek#2