add authorization endpoint

This commit is contained in:
Cayo Puigdefabregas 2023-11-29 12:27:20 +01:00
parent 222509c72c
commit 5e76b4631f
3 changed files with 13 additions and 7 deletions

View File

@ -67,18 +67,18 @@ class Organization(models.Model):
""" """
Send the verificable presentation to Verifier Send the verificable presentation to Verifier
""" """
url = "{url}/verify".format(
url=self.response_uri.strip("/"),
)
auth = (self.my_client_id, self.client_secret) 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): def demand_authorization(self):
""" """
Send the a request for start a process of Verifier 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() # 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("/"), url=self.response_uri.strip("/"),
redirect_uri=settings.RESPONSE_URI redirect_uri=settings.RESPONSE_URI
) )

View File

@ -7,6 +7,8 @@ app_name = 'oidc4vp'
urlpatterns = [ urlpatterns = [
path('verify/', views.VerifyView.as_view(), path('verify', views.VerifyView.as_view(),
name="verification_portal_verify") name="verify"),
path('authorization', views.AuthorizationView.as_view(),
name="authorization"),
] ]

View File

@ -17,6 +17,10 @@ from django.shortcuts import get_object_or_404
# from more_itertools import flatten, unique_everseen # from more_itertools import flatten, unique_everseen
class AuthorizationView(View):
pass
class VerifyView(View): class VerifyView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
org = self.validate(request) org = self.validate(request)