Build path

Build path

One ordered list of real code tasks in the PaymentSecurityJourney repo. A step is done only when its proof passes on your machine. Each step links to where the concept is explained.

8Done
1In progress
4Next
2Later
You are here9. Redis: shared login sessions

One rule: a new concept goes into its existing home (a Guide section or a Decision Card), never a new page. New effort goes into Build steps and Lab log entries.

  1. Default gate Done

    Spring Boot secures every endpoint with the default filter chain.

    Done when: Any endpoint without a token returns 401.

  2. Authorization server issues JWTs Done

    Spring Authorization Server on :9000 signs RS256 JWTs; users log in with the authorization code flow.

    Done when: A token from Postman decodes on jwt.io with iss http://localhost:9000.

  3. Stateless resource servers with scope rules Done

    Services A, B and Notification verify JWTs locally; GET needs payment.read, POST needs payment.write.

    Done when: test-all.ps1: missing token 401, wrong scope 403, right scope 200.

  4. Ownership: another user's payment is 404 Done

    Service B takes the owner from the JWT sub and never returns someone else's payment.

    Done when: Alice asking for Nithin's payment id gets 404.

  5. Service-to-service with client credentials Done

    Service B gets its own token (scope notification.send) to call the Notification Service.

    Done when: A payment triggers the email; B's token has sub = payment-service-b.

  6. Real users: database + BCrypt Done

    Auth server loads users from a database table with BCrypt hashes instead of in-memory users.

    Done when: Login works after a restart; the stored password starts with {bcrypt}; a disabled user cannot log in.

    Proved by ExA1_DbUsersTest and ExA2_RegisterEndpointTest (H2 in memory): BCrypt hash stored, disabled user refused, POST /register works. Since 18 Oct, /register is admin-only with the first admin seeded from env vars.

  7. Account lockout after failed logins Done

    Lock an account for a few minutes after 5 wrong passwords; reset on success.

    Done when: The 6th wrong password returns "locked"; it unlocks by itself.

    Proved by ExB_LockoutTest, 6 of 6 green: 5 wrong passwords lock the account for 15 minutes (LoginAttemptListener, stored in lockedUntil); the custom LockoutAwareFailureHandler still stores a LockedException, so B1 passes.

  8. Security tests for Services A and B Done

    One allowed and one denied test per security rule, with MockMvc and jwt().

    Done when: mvn test is green: no token 401, wrong scope 403, right scope 200, other user's payment 404.

    Proved on 2026-10-18 with mvn test: Service B 30 of 30, Service A 23 of 23. Both BUILD SUCCESS.

  9. Redis: shared login sessions Now

    Spring Session + Redis on the auth server, so a restart or a second instance keeps users logged in.

    Done when: Log in, restart the auth server, refresh: still logged in.

  10. Hardening: JSON errors, rate limits, two chains Later

    401/403 as JSON matching GlobalExceptionHandler; login rate limit; separate API and web chains where needed.

    Done when: 401 and 403 bodies are JSON; request 6 in a burst gets 429.

  11. OAuth2 login with Google or GitHub Later

    Users can sign in with an external identity provider, mapped to local roles.

    Done when: Google login lands on the app with the right roles.

To update this page, edit skills/concept-explorer/learn/path_data.py and run python3 skills/concept-explorer/learn/build_path.py.