Plugin : authentification via Authelia (SSO) #12

Open
opened 2026-05-16 18:03:06 +02:00 by Claude · 1 comment
Collaborator

Objectif

Créer un plugin authelia-sso permettant de déléguer l'authentification à Authelia, en test du système de plugins.

Comportement attendu

  1. L'utilisateur se connecte à NoxIRC avec son username/password Authelia
  2. Le plugin intercepte la tentative de login via le hook on_user_auth
  3. Il appelle POST /api/firstfactor sur l'instance Authelia configurée
  4. Si Authelia valide → login accepté (mot de passe NoxIRC ignoré)
  5. Si Authelia refuse → fallback sur le mot de passe NoxIRC local
  6. Option : auto-provisioning du compte NoxIRC si l'utilisateur n'existe pas encore

Changements backend nécessaires

  • Ajouter on_user_auth dans AVAILABLE_HOOKS
  • Modifier POST /api/auth/login pour appeler le hook avant verify_password
  • Si un plugin retourne {"success": True} → auth acceptée sans vérification du hash
  • Si retourne {"success": False} → auth refusée immédiatement
  • Si retourne None ou exception → fallback sur l'auth locale normale

Structure du plugin

authelia-sso/
├── plugin.json
└── main.py

Permissions requises : network.outbound:<authelia-host>

Configuration (via ctx.store_set) :

  • authelia_url : URL de base Authelia (ex: https://auth.example.com)
  • auto_provision : "true" pour créer automatiquement les comptes

Notes

  • Test réel du système de hooks d'authentification
  • Pas de dépendance Authelia obligatoire : fallback transparent si plugin absent/erreur
## Objectif Créer un plugin `authelia-sso` permettant de déléguer l'authentification à [Authelia](https://www.authelia.com/), en test du système de plugins. ## Comportement attendu 1. L'utilisateur se connecte à NoxIRC avec son username/password Authelia 2. Le plugin intercepte la tentative de login via le hook `on_user_auth` 3. Il appelle `POST /api/firstfactor` sur l'instance Authelia configurée 4. Si Authelia valide → login accepté (mot de passe NoxIRC ignoré) 5. Si Authelia refuse → fallback sur le mot de passe NoxIRC local 6. Option : auto-provisioning du compte NoxIRC si l'utilisateur n'existe pas encore ## Changements backend nécessaires - Ajouter `on_user_auth` dans `AVAILABLE_HOOKS` - Modifier `POST /api/auth/login` pour appeler le hook avant `verify_password` - Si un plugin retourne `{"success": True}` → auth acceptée sans vérification du hash - Si retourne `{"success": False}` → auth refusée immédiatement - Si retourne `None` ou exception → fallback sur l'auth locale normale ## Structure du plugin ``` authelia-sso/ ├── plugin.json └── main.py ``` **Permissions requises :** `network.outbound:<authelia-host>` **Configuration** (via `ctx.store_set`) : - `authelia_url` : URL de base Authelia (ex: `https://auth.example.com`) - `auto_provision` : `"true"` pour créer automatiquement les comptes ## Notes - Test réel du système de hooks d'authentification - Pas de dépendance Authelia obligatoire : fallback transparent si plugin absent/erreur
Author
Collaborator

Implémenté dans le commit 1b96151.

Backend :

  • on_user_auth ajouté aux hooks disponibles
  • HookResult.return_value : les handlers peuvent maintenant retourner une valeur
  • login appelle le hook avant verify_password — court-circuit ou fallback selon le retour du plugin

Plugin authelia-sso :

  • Appelle POST /api/firstfactor sur l'instance Authelia configurée via ctx.store_set('authelia_url', '...')
  • Fallback transparent si Authelia inaccessible
  • Dossier plugins/authelia-sso/ dans le repo

En attente de test avec une vraie instance Authelia.

Implémenté dans le commit 1b96151. **Backend :** - `on_user_auth` ajouté aux hooks disponibles - `HookResult.return_value` : les handlers peuvent maintenant retourner une valeur - `login` appelle le hook avant `verify_password` — court-circuit ou fallback selon le retour du plugin **Plugin `authelia-sso` :** - Appelle `POST /api/firstfactor` sur l'instance Authelia configurée via `ctx.store_set('authelia_url', '...')` - Fallback transparent si Authelia inaccessible - Dossier `plugins/authelia-sso/` dans le repo En attente de test avec une vraie instance Authelia.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NesquiikLab/NoxIRC#12
No description provided.