[Issue 55] user identity and access management system implementation - #96
Open
zephris wants to merge 28 commits into
Open
[Issue 55] user identity and access management system implementation#96zephris wants to merge 28 commits into
zephris wants to merge 28 commits into
Conversation
…jango OIDC admin auth - add Keycloak to dev/prod deployment flow with realm skeleton import support - implement Django admin OIDC login integration using Keycloak - add custom auth backend to map claims and effective realm roles to Django staff/superuser - fetch effective roles through Keycloak Admin API to resolve admin authorization reliably - add scripts to bootstrap env, deploy with Keycloak, provision linked admin user, and sync live admin password - unify first-login credentials under FIRST_PLATFORM_ADMIN and sync related Keycloak/Django aliases - ensure the same first admin identity is linked across Keycloak and Django admin paths - update env examples and README documentation for setup, first-login credentials, and sync behavior
…_system_implementation
added 2 commits
July 11, 2026 07:53
oMakaron
reviewed
Jul 11, 2026
oMakaron
left a comment
Contributor
There was a problem hiding this comment.
lgtm... nah gotta read ts
There was a problem hiding this comment.
Pull request overview
Implements a Keycloak-backed IAM path for Django admin (OIDC) alongside new frontend-facing signup/login endpoints, and updates the data model + deployment tooling to support the new auth flows.
Changes:
- Adds Keycloak OIDC integration wiring (settings, URLs, auth backend, env/config, docker-compose) for admin authentication.
- Introduces self-service auth endpoints (
/api/auth/signup/,/api/auth/login/) plus serializers and tests for “normal users”. - Renames core models (
Users→User,Chapters→Chapter), adds membership constraints, and provides migrations/scripts/docs to keep dev/prod consistent.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/pyproject.toml | Adds mozilla-django-oidc dependency for OIDC integration. |
| server/poetry.lock | Updates lockfile to include OIDC deps and bumps some packages. |
| server/api/urls.py | Adds admin OIDC login route and conditionally mounts OIDC endpoints. |
| server/api/settings.py | Adds AUTH_SOURCE-gated OIDC + Keycloak settings and backend selection. |
| server/agronomy_club/views.py | Adds signup/login APIViews; tightens queryset typing patterns. |
| server/agronomy_club/urls.py | Exposes /auth/signup/ and /auth/login/ under the API namespace. |
| server/agronomy_club/tests.py | Updates model references; adds auth endpoint tests and membership validation tests. |
| server/agronomy_club/serializers.py | Adds serializers for normal-user auth flows and user payload shaping. |
| server/agronomy_club/models.py | Renames models, adds password hashing field/methods, and adds membership constraints + validation. |
| server/agronomy_club/migrations/0009_user_password_and_membership_constraints.py | Adds password_hash, updates membership position default, and enforces unique membership constraint. |
| server/agronomy_club/migrations/0010_rename_chapters_chapter_rename_users_user_and_more.py | Renames models and sets explicit DB table names. |
| server/agronomy_club/auth_views.py | Adds an admin login redirector into the OIDC auth-init flow. |
| server/agronomy_club/auth_backends.py | Adds a Keycloak-aware OIDC backend that maps realm roles to Django admin flags. |
| server/agronomy_club/admin.py | Updates admin registrations to renamed models. |
| server/.env.example | Adds Keycloak/OIDC configuration variables for local development. |
| scripts/sync-keycloak-first-admin-password.sh | Automates first-admin password sync/rotation in Keycloak and .env. |
| scripts/ensure-keycloak-test-admin.sh | Ensures a Keycloak test admin user exists and has platform_admin. |
| scripts/deploy-with-keycloak.sh | One-command helper to bootstrap env, import realm skeleton, and run compose. |
| scripts/bootstrap-keycloak-env.sh | Bootstraps Keycloak + Django env vars and unifies first-admin identity variables. |
| README.md | Documents new auth endpoints and Keycloak deployment workflow. |
| keycloak/import/agronomy-club-realm-skeleton.json | Adds an importable realm skeleton (including clients/roles/groups). |
| keycloak/agronomy-club-realm-skeleton.json | Adds a realm skeleton source file (non-import path). |
| docker-compose.yml | Adds a Keycloak service for dev deployments. |
| docker-compose.prod.yml | Adds Keycloak service for prod deployments and wires server dependency. |
| client/.env.example | Adds Keycloak env vars for frontend configuration. |
| .env.prod.example | Adds Keycloak env vars for production configuration example. |
Comments suppressed due to low confidence (1)
server/agronomy_club/admin.py:43
- This introduces storage of user password hashes (
password_hash) in the app-levelUsermodel; by default Django admin will display and allow editing this field on theUserchange form. Even though it's hashed, exposing it in the admin UI increases the risk of accidental disclosure/copying and makes it easy to corrupt accounts by editing it directly. Exclude the field from the ModelAdmin (or mark it read-only) and provide a dedicated password reset flow if needed.
@admin.register(User)
class UsersAdmin(admin.ModelAdmin):
list_display = ('id', 'full_name', 'grad_yr', 'discipline', 'email', 'global_role')
search_fields = ('id', 'full_name', 'discipline',)
list_filter = ('grad_yr', 'global_role')
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…_system_implementation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
zephris
marked this pull request as draft
July 14, 2026 06:08
Games4Doritos
requested changes
Jul 14, 2026
Games4Doritos
left a comment
Collaborator
There was a problem hiding this comment.
Just some surface-level critiques I can give, unfortunately getting the rest of the MVP done first is our priority
zephris
force-pushed
the
issue-55-User_Identity_and_Access_Management_system_implementation
branch
from
July 15, 2026 07:03
e934f02 to
d502a78
Compare
…_system_implementation
zephris
force-pushed
the
issue-55-User_Identity_and_Access_Management_system_implementation
branch
from
July 15, 2026 08:17
6110c75 to
f031de7
Compare
zephris
marked this pull request as ready for review
July 15, 2026 08:21
…_system_implementation
…_system_implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Adds Keycloak-based IAM integration, introduces self-service auth APIs for normal users, and improves deployment/configuration consistency across dev and prod.
Change Form
Fill this up (NA if not available). If a certain criteria is not met, can you please give a reason.
Other Information
Closes #55