From 59c99d82794291daf116b2daae4e0eb24cf583dd Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 25 Mar 2024 16:19:40 +0100 Subject: [PATCH] send to api --- oidc4vp/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oidc4vp/views.py b/oidc4vp/views.py index 0f60e94..31332aa 100644 --- a/oidc4vp/views.py +++ b/oidc4vp/views.py @@ -1,6 +1,7 @@ import json import base64 import logging +import requests from django.template import loader from django.core.mail import EmailMultiAlternatives @@ -149,10 +150,16 @@ class VerifyView(View): for user in User.objects.filter(is_admin=True): self.send_email(user) + self.send_api() response["response"] = "Validation Code {}".format(code) return JsonResponse(response) + def send_api(self): + data = {"vp": self.vp_token.vp_token, "code": self.vp_token.code} + url = self.vp_token.org.response_uri + requests.post(url, data=data) + def validate(self, request): auth_header = request.headers.get('Authorization', b'') auth_data = auth_header.split()