Implement NetKingdom identity shell for coulomb.social (CSOC-WP-0002)
Django scaffold aligned with the business delivery lane: tenant-keyed Member model without passwords, identity app as sole OIDC/session boundary, dev-claims login, authenticated /app/ shell, ADR-0001, and tests. T01/T02/T05/T06 done; OIDC registration, real user-engine HTTP, flex-auth, and packaging remain open.
This commit is contained in:
parent
2ec7761504
commit
01da195c13
51 changed files with 2215 additions and 41 deletions
0
coulomb_social/apps/core/__init__.py
Normal file
0
coulomb_social/apps/core/__init__.py
Normal file
7
coulomb_social/apps/core/apps.py
Normal file
7
coulomb_social/apps/core/apps.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CoreConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "coulomb_social.apps.core"
|
||||
label = "core"
|
||||
9
coulomb_social/apps/core/context_processors.py
Normal file
9
coulomb_social/apps/core/context_processors.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def site_context(request):
|
||||
return {
|
||||
"site_name": "coulomb.social",
|
||||
"default_tenant_id": settings.DEFAULT_TENANT_ID,
|
||||
"oidc_enabled": settings.OIDC_ENABLED,
|
||||
}
|
||||
10
coulomb_social/apps/core/urls.py
Normal file
10
coulomb_social/apps/core/urls.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "core"
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.landing, name="landing"),
|
||||
path("app/", views.app_home, name="app_home"),
|
||||
]
|
||||
7
coulomb_social/apps/core/urls_health.py
Normal file
7
coulomb_social/apps/core/urls_health.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.healthz, name="healthz"),
|
||||
]
|
||||
41
coulomb_social/apps/core/views.py
Normal file
41
coulomb_social/apps/core/views.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest, HttpResponse, JsonResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
|
||||
def landing(request: HttpRequest) -> HttpResponse:
|
||||
if request.user.is_authenticated:
|
||||
from django.shortcuts import redirect
|
||||
|
||||
return redirect("core:app_home")
|
||||
return render(request, "core/landing.html")
|
||||
|
||||
|
||||
@login_required
|
||||
def app_home(request: HttpRequest) -> HttpResponse:
|
||||
member = getattr(request.user, "member", None)
|
||||
return render(
|
||||
request,
|
||||
"core/app_home.html",
|
||||
{
|
||||
"member": member,
|
||||
"principal": {
|
||||
"username": request.user.get_username(),
|
||||
"display_name": (
|
||||
member.display_name
|
||||
if member and member.display_name
|
||||
else request.user.get_full_name() or request.user.get_username()
|
||||
),
|
||||
"issuer": member.issuer if member else "",
|
||||
"subject": member.subject if member else "",
|
||||
"user_engine_user_id": (
|
||||
str(member.user_engine_user_id) if member else ""
|
||||
),
|
||||
"tenant_id": member.tenant_id if member else "",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def healthz(_request: HttpRequest) -> JsonResponse:
|
||||
return JsonResponse({"status": "ok", "service": "coulomb-social"})
|
||||
Loading…
Add table
Add a link
Reference in a new issue