GijsTimmers / kotnetcli

An easy automated way to log in on Kotnet.
GNU General Public License v3.0
5 stars 4 forks source link

YAML file as database back-end for kotnetcli-server #109

Open jovanbulck opened 8 years ago

jovanbulck commented 8 years ago

Different CGI scripts on kotnetcli test server should communicate via a simple YAML file, acting as a persistent database back-end. To ensure deterministic test behavior, we want to start up with "clean"/known database state every time we re-start server.py. I therefore propose to:

  1. create an init_db.yml file in kotnetcli/server with known dummy state
  2. before starting the CGIHTTPServer, server.py copies this file into a new temporary file, say tmp_db.yml (see https://docs.python.org/2/library/tempfile.html)
  3. on cgi-bin/wayf2.pl GET request for a specific user, the returned pwdxxx and a timestamp are saved into tmp_db.yml (as a yaml attribute for that user)
  4. on cgi-bin/netlogin.pl POST request, the info from tmp_db.yml is used to validate the request; on success, the IP address and other relevant info is stored in tmp_db.yml (as a yaml attribute for that user)