demand authorization get to verifier

This commit is contained in:
Cayo Puigdefabregas 2023-11-28 12:49:28 +01:00
parent cfbbaf491e
commit 5e95d6b15c
1 changed files with 46 additions and 59 deletions

View File

@ -2,7 +2,7 @@ import json
from django.views.generic.edit import View
from oidc4vp.models import Authorization
from oidc4vp.models import Authorization, Organization
from django.http import HttpResponse
@ -11,36 +11,24 @@ from django.http import HttpResponse
# from utils.idhub_ssikit import verify_presentation
# from oidc4vp.models import VPVerifyRequest
# from django.shortcuts import get_object_or_404
from django.shortcuts import get_object_or_404
# from more_itertools import flatten, unique_everseen
class VerifyView(View):
def get(self, request, *args, **kwargs):
import pdb; pdb.set_trace()
res = json.dumps({"uri": "http://localhost:10000"})
return HttpResponse(res)
def DemandAuthorizationView(request):
assert request.method == "GET"
import pdb; pdb.set_trace()
params = request.GET.params
org = Organization.objects.filter(
url=params.get('redirect_uri')
)
org_url = request.GET.get('demand_uri')
org = get_object_or_404(Organization, response_uri=org_url)
authorization = Authorization(
organization=org,
presentation_definition="MemberCredential"
)
# authorization.save()
res = json.dumps({"uri": authorization.authorize()})
import pdb; pdb.set_trace()
res = json.dumps({"redirect_uri": authorization.authorize()})
return HttpResponse(res)
def verify(request):
def post(self, request, *args, **kwargs):
import pdb; pdb.set_trace()
# assert request.method == "POST"
# # TODO: incorporate request.POST["presentation_submission"] as schema definition
# (presentation_valid, _) = verify_presentation(request.POST["vp_token"])
# if not presentation_valid:
@ -76,4 +64,3 @@ def verify(request):
# raise Exception("Unknown action!")
# # OK! Your verifiable presentation was successfully presented.
# return HttpResponseRedirect(vr.response_or_redirect)