From 5e76b4631f693c2b36d3deb780c777821002e10b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 29 Nov 2023 12:27:20 +0100 Subject: [PATCH] add authorization endpoint --- oidc4vp/models.py | 10 +++++----- oidc4vp/urls.py | 6 ++++-- oidc4vp/views.py | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/oidc4vp/models.py b/oidc4vp/models.py index 37a18f9..f004494 100644 --- a/oidc4vp/models.py +++ b/oidc4vp/models.py @@ -67,18 +67,18 @@ class Organization(models.Model): """ Send the verificable presentation to Verifier """ + url = "{url}/verify".format( + url=self.response_uri.strip("/"), + ) auth = (self.my_client_id, self.client_secret) - return requests.post(self.response_uri, data=vp, auth=auth) + return requests.post(url, data=vp, auth=auth) def demand_authorization(self): """ Send the a request for start a process of Verifier """ - org = self.__class__.objects.get( - response_uri=settings.RESPONSE_URI - ) # import pdb; pdb.set_trace() - url = "{url}/?demand_uri={redirect_uri}".format( + url = "{url}/verify?demand_uri={redirect_uri}".format( url=self.response_uri.strip("/"), redirect_uri=settings.RESPONSE_URI ) diff --git a/oidc4vp/urls.py b/oidc4vp/urls.py index d06949c..03010e8 100644 --- a/oidc4vp/urls.py +++ b/oidc4vp/urls.py @@ -7,6 +7,8 @@ app_name = 'oidc4vp' urlpatterns = [ - path('verify/', views.VerifyView.as_view(), - name="verification_portal_verify") + path('verify', views.VerifyView.as_view(), + name="verify"), + path('authorization', views.AuthorizationView.as_view(), + name="authorization"), ] diff --git a/oidc4vp/views.py b/oidc4vp/views.py index 045731f..7b1666d 100644 --- a/oidc4vp/views.py +++ b/oidc4vp/views.py @@ -17,6 +17,10 @@ from django.shortcuts import get_object_or_404 # from more_itertools import flatten, unique_everseen +class AuthorizationView(View): + pass + + class VerifyView(View): def get(self, request, *args, **kwargs): org = self.validate(request)