Security and JWT web tokens¶
AyaNova uses JSON Web Tokens (JWT) for authentication.
When a User logs in, the AyaNova server issues them a time limited token signed with the server's own sign-in key. The token is sent with every request the User makes and is verified by the server each time.
Tokens expire 5 days after they are issued, and each User can only have one current token: logging in again replaces the previous one.
(Individual Users can be prevented from logging in or accessing the server by setting them inactive, which takes effect immediately regardless of how many days are left on their current token.)
The sign-in key¶
The AyaNova server generates its sign-in key automatically the first time it starts and keeps it in a file named jwt-signing.key in the AyaNova data folder. It is used from then on, so Users stay logged in when the server restarts. There is nothing to configure.
Keep the data folder protected like the rest of AyaNova's data: anyone who can read the sign-in key file could create valid tokens.
Signing everyone out¶
To invalidate every token that has been issued (for example if you suspect a token or the key file was exposed): stop the AyaNova server, delete the jwt-signing.key file from the data folder, and start the server again. A new key is generated and every User will need to log in again.
AYANOVA_JWT_SECRET (no longer used)¶
Before version 8.3.0 the sign-in key could be set with an AYANOVA_JWT_SECRET configuration setting. That setting is no longer used: if it is still present in config.json, an environment variable or the command line it is ignored, a note is written to the server log, and it can safely be removed.