fix credentials

This commit is contained in:
Cayo Puigdefabregas 2023-11-29 11:18:12 +01:00
parent 4a3cf5c5df
commit 37d3430680
2 changed files with 6 additions and 8 deletions

View File

@ -54,12 +54,9 @@ class Organization(models.Model):
)
my_client_id = models.CharField(
max_length=24,
default=set_client_id,
unique=True
)
my_client_secret = models.CharField(
max_length=48,
default=set_client_secret
)
response_uri = models.URLField(
help_text=_("Url where to send the verificable presentation"),
@ -128,7 +125,7 @@ class Authorization(models.Model):
data = {
"response_type": "vp_token",
"response_mode": "direct_post",
"client_id": self.organization.client_id,
"client_id": self.organization.my_client_id,
"presentation_definition": self.presentation_definition,
"nonce": gen_salt(5),
}

View File

@ -19,13 +19,13 @@ from django.shortcuts import get_object_or_404
class VerifyView(View):
def get(self, request, *args, **kwargs):
org = self.validate(request)
if not org:
raise Http404("Page not Found!")
# TODO Not hardcode the list of types of presentation_definition
presentation_definition = json.dumps(['MemberCredential'])
authorization = Authorization(
organization=org,
presentation_definition="MemberCredential"
presentation_definition=presentation_definition
)
res = json.dumps({"redirect_uri": authorization.authorize()})
return HttpResponse(res)
def validate(self, request):
@ -45,6 +45,7 @@ class VerifyView(View):
return org
def post(self, request, *args, **kwargs):
org = self.validate(request)
import pdb; pdb.set_trace()
# # TODO: incorporate request.POST["presentation_submission"] as schema definition
# (presentation_valid, _) = verify_presentation(request.POST["vp_token"])