mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-19 04:40:32 -05:00
e34a668ddc
Introduce AUTH_METHOD values ldap and all, with LDAP_* environment settings, ldap3-based LDAPService (search, optional groupOfNames checks, user bind, DB sync), and users.auth_provider (local|oidc|ldap) via migration 153_add_user_auth_provider. Login supports LDAP-only and combined all (local then LDAP where appropriate); OIDC callback sets auth_provider. Forgot/reset/change password flows skip LDAP-managed accounts. Admin System Settings gains a read-only LDAP summary and POST /admin/ldap/test. Production env validation requires core LDAP variables when LDAP is enabled; OIDC registration and docs recognize all. Documentation: new docs/admin/configuration/LDAP_SETUP.md; updates to OIDC_SETUP, GETTING_STARTED, Docker guides, Render deploy notes, docs README, and CHANGELOG. Tests: tests/test_ldap_auth.py; test_oidc_logout allows auth_method all.
2.3 KiB
2.3 KiB
LDAP authentication
TimeTracker can authenticate users against an LDAP directory (OpenLDAP-style groupOfNames / member checks). LDAP is optional and is controlled with AUTH_METHOD and environment variables (see root env.example for a commented template).
When to use which AUTH_METHOD
| Value | Meaning |
|---|---|
ldap |
Directory login only (same username/password form; users are provisioned or synced in the local DB on success). |
all |
Local passwords, OIDC SSO, and LDAP are all available (see OIDC Setup for SSO). Login tries local first for users whose auth_provider is not ldap, then LDAP. |
For LDAP only or combined mode, set the variables documented in env.example under LDAP Authentication. In production, if LDAP is enabled, LDAP_HOST, LDAP_BASE_DN, LDAP_BIND_DN, and LDAP_BIND_PASSWORD are required (startup validation).
Behaviour summary
- Service account: Binds with
LDAP_BIND_DN/LDAP_BIND_PASSWORD, searches for the user underLDAP_USER_DN+LDAP_BASE_DN, optionally verifies membership inLDAP_REQUIRED_GROUP(bycnunderLDAP_GROUP_DN), then verifies the password with a second bind as the user. - Provisioning: Users are matched primarily by email from
LDAP_USER_EMAIL_ATTR. Without an email, login cannot create or link an account. - Profile sync: On each successful LDAP login,
full_name(fromgivenName+sn) and admin flag (viaLDAP_ADMIN_GROUPand legacyrolefield) are updated from the directory. - Local passwords: LDAP-managed accounts have
auth_provider=ldapand cannot use forgot-password, reset-password, or in-app password change flows. - Admin UI: Admin → System Settings includes a read-only LDAP summary and Test LDAP Connection (
POST /admin/ldap/test) for a non-destructive bind and user count under the configured user subtree.
Kiosk mode
Kiosk login continues to use local passwords only (same requires_password rules as local / both / all for the form). LDAP-only users must have a usable local password for kiosk, or use standard web login.
Further reading
- OIDC Setup —
AUTH_METHODoverview includingall. - Docker Compose environment — variable list entry point.