Skip to content

feat: answer signed-out GET /users/me with 204 - #32

Merged
alexmcdermid merged 1 commit into
mainfrom
fix/public-session-check
Oct 17, 2026
Merged

alexmcdermid merged 1 commit into
mainfrom
fix/public-session-check

Conversation

@alexmcdermid

@alexmcdermid alexmcdermid commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Stops the signed-out page load from logging GET /api/v1/users/me 401 (Unauthorized).

GET /api/v1/users/me is now public:

  • Signed in: 200 with the same UserProfileResponse as before.
  • Signed out: 204 No Content instead of 401.

Safety:

  • Only the exact GET /users/me route is opened (requestMatchers(HttpMethod.GET, ApiPaths.USER_ME)). /users/me/preferences, /users/me/accounts and /users/me/legal-agreement still require a session. A new test covers that; it fails if the rule is widened to /users/me/**.
  • A signed-out call creates no session, sets no cookie and returns no data. Responses stay no-store, so a proxy can't cache one user's profile for another.
  • An expired session (AbsoluteSessionTimeoutFilter) is cleared before the controller runs and gets a 204.
  • LegalAgreementFilter already exempted GET /users/me, so users who haven't accepted the terms still get their profile.

No merge order: the frontend change (alexmcdermid/tradingView#50) treats both 204 and the old 401 as signed out.

Testing:

  • mvn -B test: 129 passing. New AuthControllerTest cases: signed out → 204 with no session or cookie and no-store; /users/me/* sub-routes still 401 when signed out; expired session → 204. The absolute-timeout test now checks a protected route for its 401.

GET /users/me is now public and returns 204 No Content when there is no
session, instead of the 401 that Chrome logs as a failed request on every
signed-out page load. Signed-in callers get their profile as before.

Only the exact GET /users/me route is opened; /users/me/preferences,
/users/me/accounts and /users/me/legal-agreement still require a session,
and a test covers that. Signed-out calls create no session and responses
stay no-store. The absolute-timeout test now checks a protected route for
the 401, and a new test checks /users/me returns 204 after expiry.
@alexmcdermid
alexmcdermid force-pushed the fix/public-session-check branch from 0ae9a15 to eb4ecd7 Compare October 17, 2026 17:14
@alexmcdermid alexmcdermid changed the title feat: add public session check endpoint feat: answer signed-out GET /users/me with 204 Oct 17, 2026
@alexmcdermid
alexmcdermid merged commit 3db99a0 into main Oct 17, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
dev — eb4ecd7d Deployed Oct 17, 2026 by alexmcdermid via pause-when-idle #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant