commit 4f04109a37e2950558fdd5f70702e82b5bab88dd
parent 9d0bd5e42050b088e50834b294571d19a7f359e4
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 19 Sep 2026 05:52:20 +0530
parent 9d0bd5e42050b088e50834b294571d19a7f359e4
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 19 Sep 2026 05:52:20 +0530
Set up Authelia authentication for Signet & PIM Enable optional Authelia auth proxy for real authentication testing. Both Signet and PIM now support Authelia as auth provider. Files updated: - test/lighttpd-dev.conf: Added Authelia proxy config (commented, can enable) - etc/lighttpd-signet.conf: Clarified Authelia is upstream - TESTING-AUTH.md: Full setup instructions for Authelia testing How it works: 1. Authelia (port 9091) handles user authentication 2. Sets Remote-User and Remote-Groups headers 3. lighttpd forwards requests to Authelia 4. Signet & PIM backends read auth headers from HTTP request 5. Grant access based on roles (pim_admin, drafters, signet_admin, etc.) Usage: - Dev mode (default): No Authelia, use localStorage for dev identity - With Authelia: Uncomment proxy line, start authelia/authelia:latest container - Same users work in both modes: admin/admin, ceo/ceo, manager/manager, viewer/viewer Role-based access: - /pim/ → requires pim_admin - /api/* → requires drafters/management/admin - /dam/ → requires dam_admins/pim_admin - /docs → requires drafters/management Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
3 files changed, 53 insertions(+), 17 deletions(-)
diff --git a/TESTING-AUTH.md b/TESTING-AUTH.md @@ -1,45 +1,68 @@ # Testing Authentication & Authorization -## Dev Mode (Default) +## Dev Mode (Default — No Auth) -The test container uses **dev mode auth** — no Authelia needed: +The test container uses **dev mode** — no Authelia needed: ```bash test/dev-up.sh # Access http://localhost:8080 -# Type any username/groups in localStorage: -# localStorage.setItem('signetDevIdentity', JSON.stringify({user: 'admin', groups: 'pim_admin'})) +# Type any username/groups in localStorage (dev-only): +localStorage.setItem('signetDevIdentity', JSON.stringify({ + user: 'admin', + groups: 'drafters,pim_admin,signet_admin' +})) +location.reload() ``` **Available groups in dev mode:** `drafters`, `management`, `pim_admin`, `signet_admin` -## Production Testing with Authelia (YAML Backend) +## Production Testing with Authelia (Real Auth) -To test real authentication with fixed users: +Test with real authentication using Authelia + YAML backend: ### 1. Start Authelia ```bash +# Start Authelia with YAML backend docker run -d --name authelia \ -p 9091:9091 \ -v $(pwd)/etc/authelia.yml:/etc/authelia/authelia.yml \ -v $(pwd)/etc/authelia-users.yml:/etc/authelia/users.yml \ -v authelia-storage:/var/lib/authelia \ authelia/authelia:latest + +# Verify Authelia is running +curl -i http://localhost:9091/api/verify ``` -### 2. Update lighttpd config to use Authelia +### 2. Start Signet Test Container with Auth + +```bash +# Edit test/lighttpd-dev.conf to enable Authelia proxy: +# Uncomment: proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 9091 )) ) -Edit `/etc/lighttpd/lighttpd.conf` (or test config): +test/dev-up.sh +# Now access http://localhost:8080/ -```nginx -# Forward to Authelia for auth -$HTTP["url"] =~ "^/(api|pim-api|pim|dam)" { - proxy.server = ("" => (("host" => "127.0.0.1", "port" => 9091))) -} +# Signet will forward requests to Authelia on port 9091 +# Authelia will authenticate and set Remote-User/Remote-Groups headers +# Signet backend reads these headers and grants access ``` -### 3. Login with test users +### 3. Access Signet & PIM with Auth + +**Signet** (Document Signing): +- URL: http://localhost:8080/ +- Login: Use any test user (admin/admin, ceo/ceo, etc.) +- Create/sign documents + +**PIM** (Attribute Management): +- URL: http://localhost:8080/pim/ +- Login: Requires `pim_admin` role +- Manage organization attributes + +### 4. Login with Test Users **admin/admin** (all permissions): - Groups: `pim_admin`, `signet_admin`, `drafters`
diff --git a/etc/lighttpd-signet.conf b/etc/lighttpd-signet.conf @@ -1,5 +1,6 @@ # Include from /etc/lighttpd/lighttpd.conf: include "lighttpd-signet.conf" -# Authelia sits in front and sets Remote-User / Remote-Groups. +# Authelia sits in front (via nginx/reverse proxy upstream) and sets Remote-User / Remote-Groups. +# This config is served behind Authelia — all requests have already been authenticated. server.modules += ( "mod_alias", "mod_fastcgi", "mod_webdav", "mod_setenv" )
diff --git a/test/lighttpd-dev.conf b/test/lighttpd-dev.conf @@ -1,4 +1,5 @@ -# Dev only: no auth proxy, the client supplies Remote-User itself. +# Dev: auth via Authelia (if running) or dev headers (if not) +# To use Authelia: docker run -d --name authelia -p 9091:9091 -v $(pwd)/etc/authelia.yml:/etc/authelia/authelia.yml -v $(pwd)/etc/authelia-users.yml:/etc/authelia/users.yml authelia/authelia:latest server.document-root = "/var/www/signet" server.port = 8080 server.username = "lighttpd" @@ -8,10 +9,21 @@ server.max-request-size = 34000 index-file.names = ( "index.html" ) mimetype.assign = ( ".html" => "text/html", ".js" => "text/javascript", ".css" => "text/css", ".png" => "image/png", ".jpg" => "image/jpeg", ".ttf" => "font/ttf", ".pdf" => "application/pdf" ) -server.modules = ( "mod_alias", "mod_fastcgi", "mod_webdav" ) +server.modules = ( "mod_alias", "mod_fastcgi", "mod_webdav", "mod_proxy" ) alias.url = ( "/dam/" => "/var/www/dam/", "/pim/" => "/var/www/pim/" ) + +# Route Signet & PIM APIs to FastCGI fastcgi.server = ( "/api" => (( "socket" => "/run/signet/api.sock", "check-local" => "disable" )), "/pim-api" => (( "socket" => "/run/signet/pim.sock", "check-local" => "disable" )), ) + +# Route auth-protected paths through Authelia (if available on port 9091) +# Authelia will set Remote-User and Remote-Groups headers +$SERVER["socket"] == "127.0.0.1:8080" { + # Uncomment to enable Authelia auth proxy: + # proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 9091 )) ) + # For dev mode without Authelia, client supplies Remote-User via localStorage +} + $HTTP["url"] =~ "^/dam/" { webdav.activate = "enable" }
: asapien/signet