fix(auth): restore request payload after Bearer/Basic auth in middleware#102
Merged
JanZachmann merged 3 commits intoomnect:mainfrom Feb 18, 2026
Merged
Conversation
jsonwebtoken v9 Validation::new() enforces audience (aud) validation by default. Keycloak tokens set aud to the OIDC client ID, which the backend does not know. The previous jwt-simple library did not enforce audience. Disable aud validation to match the prior behavior. Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
When the session cookie is invalid (e.g. after password change via session.purge()), the auth middleware takes the request payload to extract the Authorization header but never restores it. This causes all authenticated POST requests with a body to fail with "Json deserialize error: EOF while parsing a value at line 1 column 0". Restore the payload via req.set_payload() after successful Bearer or Basic auth. Also refactors the auth branches into a single match to prevent future omissions. Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
session.purge()(e.g. password change)req.set_payload()after successful Bearer/Basic authmatchto prevent future omissionsReason
After changing the password, the backend calls
session.purge(), invalidating the session cookie. On subsequent requests the middleware falls through to Bearer/Basic auth, callingreq.take_payload()to extract theAuthorizationheader — but never restoring the payload. The handler'sweb::Json<T>extractor then receives an empty body, producing:Json deserialize error: EOF while parsing a value at line 1 column 0.