23 Commits

Author SHA1 Message Date
Erik Thuning
ca3d536868 Added support for limited client validity
A new /cron endpoint has been introduced, which triggers a cleanup routine.
The cleanup routine loops over all existing clients and deletes all that are
older than the value configured in config.ini.

Periodically calling the cron endpoint is the responsibility of the server admin.
2025-03-26 13:30:53 +01:00
Erik Thuning
4ba871c49e Set a static flask application name 2025-03-24 16:16:13 +01:00
Erik Thuning
69fd819ee5 FIX: bad syntax when looking up dict key 2025-03-24 13:20:10 +01:00
dce824b5dd
Switch from OIDC UserInfo to OAuth 2.0 Token Introspection
The UserInfo endpoint is for fetching the users profile (name, email, phone number, picture, and so on). Token introspection is for inspecting the access token and determining the authorities the user has (subject (principal), entitlements, and scopes granted).
2025-03-24 11:03:03 +01:00
Erik Thuning
e9f180805a Started sending some serverside configuration to the client-side javascript
The information is sent via the cookie 'server_settings'. The value is a
base64-encoded json object containing the data necessary
for site-specific customization.

Also fixed a bug that was preventing the 'add new client' button from being
disabled when the client limit is reached.
2025-03-06 15:08:37 +01:00
Erik Thuning
f43aa53ca8 Added support for multiple entitlements granting site access 2025-03-04 13:53:56 +01:00
Erik Thuning
44dad4430c Fixed a type error 2025-03-04 13:12:38 +01:00
Erik Thuning
27b7b5d7de Made user_client_limit be truly optional in config.ini 2025-03-04 13:10:21 +01:00
Erik Thuning
49abf8ad21 Implemented handling of client limits, and some general tweaks
- The create button is now disabled when reaching the client limit
 - The client list is now always sorted by case-insensitive config name
 - Focus moves to the form when opening a dialog
 - Fixed some inconsistent use of snake_case vs perlCase
2025-03-04 11:14:02 +01:00
Erik Thuning
c886a7b32c Implemented support for limiting number of clients per user
The setting is global for all users and optional.
2025-03-03 13:49:42 +01:00
Erik Thuning
d56e5e2cb2 Folded all failure responses into a single function 2025-03-03 13:15:52 +01:00
Erik Thuning
311ae0276e Implemented support for entitlements-based access control
If configured, anyone missing the required entitlement will now be denied
access to the application and its api endpoints. If unset, any authenticated
user is accepted.
2025-02-27 17:25:32 +01:00
Erik Thuning
1d639fd09f Added a sanity check on config id:s
Config id:s must now match the regex ^[A-Za-z0-9-]$ in order to be considered
valid. Also rearranged early declarations to make more sense and removed
some dead code.
2025-02-27 15:21:35 +01:00
Erik Thuning
1b44178084 FIX: Fat fingers 2025-02-19 15:19:36 +01:00
Erik Thuning
1e5bf1aa9a Set samesite attribute as appropriate on all cookies. 2025-02-19 15:11:21 +01:00
Erik Thuning
8481b023b4 FIX: Apparently, module-global objects survive between requests
Moved the wg object into the app object, so it gets the expected lifecycle.
2025-02-19 14:45:53 +01:00
Erik Thuning
b454faea98 Switched to UUID/arbitrary ID:s for configs
Names are now for human readability only
2025-02-18 17:56:41 +01:00
Erik Thuning
804347a4d6 Fix: only set a username cookie if there is data to assign to it 2025-02-18 17:51:04 +01:00
Erik Thuning
343d7cd863 Fixed a typo 2025-02-18 17:49:44 +01:00
cfed319563 Moving closer to actual functional wireguard handling 2025-02-14 15:54:15 +01:00
c146d54d41 Lifted cookie names into variables instead of literals 2025-02-14 15:50:57 +01:00
bc4dd5d6f9 Further along the way to MVP 2025-02-13 16:51:28 +01:00
3213604a78 Initial commit 2025-02-12 16:35:20 +01:00