How would I only allow users authenticated via Python code to access certain files on the server?
For instance, say I have /static/book.txt which I want to protect. When a user accesses /some/path/that/validates/him, a Python script deems him worthy of accessing /static/book.txt and redirects him to that path.
How would I stop users who bypass the script and directly access /static/book.txt?
Lighttpd has mod_secdownload for this. Basically, it won’t serve the static content directly unless you generate a short-lived static URL for it.
Note that you can do similar things on S3 for static content. It’s a quite useful feature.