I have developed a jsp website (runs on tomcat) and the user logs in/out.
A part of the protected content involves a client/server minigame that runs on an applet and custom (nio) server.
They both share the same backend mySql database.
I’d like to have the player only login once, at the jsp login - then the applet should know who’s playing and where to store the results etc.
The only way I’ve come up for doing it, is to have tomcat store the opened logined session in the database:
<username><password><status:logined><since:19239048566><ip:1.2.3.4>
When the applet loads, it connects on the custom java server, which looks up the IP info in the DB, and if status is ‘logined’ then the minigame starts.
If not, then it denies access to the applet and updates the record in the db (for web server’s update).
Can anyone think of something better?