Repository navigation
Conversation
…on check - US-04: POST /api/auth/login verifies the credentials and creates a new server-side session; the token travels only in an HttpOnly, Secure, SameSite cookie. Wrong password, unknown account and a blocked or archived account get the same response; only the audit event records the reason. - US-05: POST /api/auth/logout revokes the session in the store and deletes the cookie; it is idempotent and leaves the user's other sessions alone. - US-06: SessionCheckMiddleware validates the cookie against the store on every request to an endpoint without [AllowAnonymous] and answers 401 for a missing, unknown, expired or revoked session (ACC-05). Development-only routes of other modules that authenticate callers themselves (/api/laboratories, /api/kt1, /api/access/demo-deny) are let through. SessionIdentityContext exposes the caller through IIdentityContext, and GET /api/auth/me returns the current user without secrets. - ISessionManager becomes the async contract backed by the session store and replaces the IDN-02 placeholders and Development stubs that reached main in #33 (LoginController, LoginAccount, ICredentialAuthenticator, ISessionIssuer, SessionValidationMiddleware and the always-active session stubs). - The IDN-03 status test uses the new contract in its fake, and the KT1 composition test now expects 401 for the X-Stub-User header. Co-authored-by: marijanamijic <marijana.mijic@toppandigital.com> Co-authored-by: didi40904 <116975925+didi40904@users.noreply.github.com> Co-authored-by: Nole <daki.nole@gmail.com> Co-authored-by: Denis Đuriš <135664071+Duro375@users.noreply.github.com> Co-authored-by: Dobi04 <nj675896@gmail.com> Co-authored-by: lmilanal <lazic.pr141.2023@uns.ac.rs> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 4, 2026
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.
Component and requirement IDs
Changes
Size: 42 files, +1645 / −792. About 1100 lines of tests and 540 lines of code; the deletions are replaced placeholders.
POST /api/auth/login(AuthController,LoginService,StoreSessionCreator). Every login creates a new session, and the token travels only in anHttpOnly,Secure,SameSite=Strictcookie, never in the body. Wrong password, unknown account and a blocked or archived account get the same response; only the audit event records the reason.POST /api/auth/logout(LogoutService) revokes the session in the store and deletes the cookie. It is idempotent and leaves the user's other sessions valid.SessionCheckMiddlewarevalidates the cookie against the store on every request to an endpoint without[AllowAnonymous], and returns401without details for a missing, unknown, expired or revoked session (ACC-05).SessionIdentityContextexposes the caller throughIIdentityContext, andGET /api/auth/mereturns the user without secrets.ISessionManagerbecomes the async contract backed by the session store. It replaces the IDN-02 placeholders and Development stubs that reachedmainin Feature/idn 03 account status #33:LoginController,LoginAccount,LoginAdapters,ICredentialAuthenticator,ISessionIssuer, the IDN-03SessionValidationMiddleware, and the always-active and no-op session stubs.Effect on other modules
/api/laboratories,/api/kt1and/api/access/demo-deny. Outside Development, these routes and every new endpoint without[AllowAnonymous]need an IDN-02 session.Platform.Identity.Tests/Services/ChangeAccountStatusTests.cs(IDN-03): its fake implements the newISessionManager. The fiveIsSessionActive_*tests that only checked that fake are removed, and the status-change tests are unchanged.Platform.Kt1.Tests/MainCompositionTests.cs(ACC-04/ADM-08, Bojana Kovacic): theX-Stub-Userheader no longer authenticates the IDN-03 administrator, because the IDN-02 session replaces that Development stub. The test now expects401and an unchanged status. Owner confirmation needed.Verification
dotnet test backend/SecurityLab.slnx -c Release: all pass. Identity 182, Kt1 65, Audit 95, Authoring 55, Laboratories 31, Platform.Tests 28, RateLimiting 24, LabMetadata 7.scripts/kt1-demo.ps1), run locally: 41/41 PASS.Architecture and data flow
Processes P1 (login), P3 (session check) and P4 (logout) of the IDN-02 DFD. The diagrams are in part 5.
Security checks and negative tests
The old cookie after logout returns 401, and so do a revoked session, an expired session, an unknown token and a missing cookie. A second logout writes no second audit event. Audit events never contain the token or its hash. Middleware tests cover the Development-only exemptions both ways: allowed in Development,
401outside it and for look-alike paths.Dependencies
Stack
mainReplaces #55.
🤖 Generated with Claude Code