Skip to content

Saml2 auth - #76

Merged
glaubervila merged 3 commits into
mainfrom
saml2_auth
Jul 24, 2026
Merged

Saml2 auth#76
glaubervila merged 3 commits into
mainfrom
saml2_auth

Conversation

@glaubervila

Copy link
Copy Markdown
Contributor

No description provided.

Implement LIneA federated login (SATOSA proxy -> CILogon and Rubin IdPs)
with djangosaml2, mirroring the working setup from lsp_daiquiri and target.
SAML cannot be tested locally, so everything is gated by the
AUTH_SAML2_ENABLED env var (default False): when disabled, nothing SAML
is loaded and login falls back to the existing admin/allauth flow.

- Add guarded SAML block to base settings: backend, middleware,
  SAML_CONFIG (SP endpoints, signed requests/responses, remote SATOSA
  metadata), attribute mapping, and login/register URLs per IdP
- Add LineaSaml2Backend (uid-based user lookup, needs_registration and
  pending-status handling, group sync preserving INTERNAL_GROUPS)
- Add saml2_template_failure view routing ACS failures to registration,
  waiting-approval, and login-error pages; use session.get("idp_name")
  to avoid a KeyError present in the reference implementation
- Mount saml2/ URLs and the /login/ IdP chooser page only when enabled
- Restore first_name/last_name on the User model (migration 0002) so the
  SAML attribute mapping matches the reference apps
- Add djangosaml2 error templates and Bootstrap 5 IdP chooser page
- Install xmlsec1 in local and production images; mount SP certificates
  as a read-only volume in production; add cert generation README and
  gitignore rules for key material
- Export SAML settings to templates via django-settings-export
- Add dedicated djangosaml2 rotating log file
- Add 26 tests covering the backend, failure view routing, and the
  flag-off wiring (no SAML in settings, 404 routes, allauth intact)
- Document production env vars and deployment steps in README and
  SAML2_IMPLEMENTATION.md
@glaubervila
glaubervila merged commit 503cd5e into main Jul 24, 2026
0 of 2 checks passed
@glaubervila
glaubervila deleted the saml2_auth branch July 24, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant