aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com
diff options
context:
space:
mode:
authorKostya <mail@sartin.in>2026-10-09 18:44:33 +0300
committerKostya <mail@sartin.in>2026-10-09 18:45:01 +0300
commit33d313e17b841db3736c465447913df0cc73d5df (patch)
tree33ecf73f3b71897c4f8413c6e61a025837d88a83 /src/main/java/com
parent9c1a10712a724b448de9e066ff76f97059c86b40 (diff)
downloadguess-market-33d313e17b841db3736c465447913df0cc73d5df.tar.gz
guess-market-33d313e17b841db3736c465447913df0cc73d5df.tar.xz
guess-market-33d313e17b841db3736c465447913df0cc73d5df.zip
server: add username login and logout endpoints
The spec asks for a login by unique name only, with no passwords or sign-up, and an error that lets the user try again if the name exists. Add POST /api/login (form field "username") and POST /api/logout. Sessions maps each name, ignoring case, to the one HTTP session holding it. A second session asking for a held name gets 409 NAME_TAKEN, and a blank name gets 400. When a session ends, by logout or by Tomcat timing it out after a client quits without logging out, an HttpSessionListener frees the name. The account itself (ledger, Market Maker roles) stays, and logging in with that name again resumes it rather than locking the user out for the life of the server. New accounts start with a zero balance and are funded through deposits. Json gives every endpoint the same response shape, with errors as {"error": CODE, "message": text} built from a failed Result. Tomcat setup for the tests moves into a shared TestServer helper, whose clients each keep their own cookie jar and so act as separate users.
Diffstat (limited to 'src/main/java/com')
0 files changed, 0 insertions, 0 deletions