1.5 KiB
1.5 KiB
CoopGameChooser Task List
Auth overhaul — username/password instead of random cookie
- Data model: add username + password hash/salt to
Player, enforce unique username, updateAppDbContextconfig and create an EF migration; ensure factory reset seeds stay valid. - Cookie pipeline: refactor
UsePlayerIdentityinto a reader that only trusts existingplayercookies; add helper to issue/clear the cookie after login/register while keeping HttpOnly/SameSite/Secure semantics. - Auth endpoints: add
/api/auth/register,/api/auth/login,/api/auth/logout; registration creates the player, sets theplayercookie, and stores display name; login validates password and reissues cookie; logout clears cookie. - Endpoint auth guard: replace
GetOrCreatePlayerwith aGetAuthenticatedPlayerhelper that returns 401 when unauthenticated; update all suggest/vote/state endpoints to depend on an authenticated player without creating one implicitly. - Frontend UX: add login/register screen shown when
/api/mereturns 401; on success hide auth pane, preload name, then refresh phase data; include a logout control to clear local state. - Docs: update
API.md(andSPEC.md) to document new auth flows, required auth for existing endpoints, and cookie token behavior. - Ops/migration notes: generate/apply migration, legacy players auto-assigned
legacy-xxxxxxxxusernames with blank hashes; expect fresh registration or factory reset; IIS/base-path unaffected.