feat: add diagnostic view and update URL routing for build probe in provider and relying party
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
from django.http import JsonResponse
|
||||
from spid_cie_oidc.entity.models import FederationEntityConfiguration, TrustChain, FetchedEntityStatement
|
||||
|
||||
|
||||
def build_probe_view(service: str):
|
||||
@@ -32,3 +33,25 @@ def build_probe_view(service: str):
|
||||
"hostname": os.getenv("HOSTNAME", ""),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def diag_view(service: str):
|
||||
configs = FederationEntityConfiguration.objects.all()
|
||||
active = FederationEntityConfiguration.objects.filter(is_active=True)
|
||||
first = configs.order_by("id").first()
|
||||
first_active = active.order_by("id").first()
|
||||
|
||||
return JsonResponse(
|
||||
{
|
||||
"ok": True,
|
||||
"service": service,
|
||||
"config_count": configs.count(),
|
||||
"active_config_count": active.count(),
|
||||
"first_sub": getattr(first, "sub", None),
|
||||
"first_entity_type": getattr(first, "entity_type", None),
|
||||
"first_active_sub": getattr(first_active, "sub", None),
|
||||
"first_active_entity_type": getattr(first_active, "entity_type", None),
|
||||
"trust_chain_count": TrustChain.objects.count(),
|
||||
"fetched_statement_count": FetchedEntityStatement.objects.count(),
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user