From a25cb5570f897152b75f5b0a70d6f19ade00cc1b Mon Sep 17 00:00:00 2001 From: frostyfan109 Date: Mon, 28 Oct 2024 15:04:53 -0400 Subject: [PATCH] remove aid info from app identity token --- appstore/api/v1/views.py | 4 ++-- appstore/core/models.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appstore/api/v1/views.py b/appstore/api/v1/views.py index 66d46423..0723cc95 100644 --- a/appstore/api/v1/views.py +++ b/appstore/api/v1/views.py @@ -604,7 +604,7 @@ def create(self, request): host = get_host(request) system = tycho.start(principal, app_id, resource_request.resources, host, env) - identity_token.consumer_id = identity_token.compute_app_consumer_id(app_id, system.identifier) + identity_token.consumer_id = identity_token.compute_app_consumer_id(system.identifier) identity_token.save() s = InstanceSpec( @@ -690,7 +690,7 @@ def destroy(self, request, sid=None): if status.services[0].username == request.user.username: response = tycho.delete({"name": serializer.validated_data["sid"]}) # Delete all the tokens the user had associated with that app - consumer_id = UserIdentityToken.compute_app_consumer_id(serializer.validated_data["aid"], serializer.validated_data["sid"]) + consumer_id = UserIdentityToken.compute_app_consumer_id(serializer.validated_data["sid"]) tokens = UserIdentityToken.objects.filter(user=request.user, consumer_id=consumer_id) tokens.delete() # TODO How can we avoid this sleep? Do we need an immediate response beyond diff --git a/appstore/core/models.py b/appstore/core/models.py index 1f0eb9a3..77ebcbc8 100644 --- a/appstore/core/models.py +++ b/appstore/core/models.py @@ -62,8 +62,8 @@ def valid(self): return timezone.now() <= self.expires @staticmethod - def compute_app_consumer_id(app_id, system_id): - return f"{ app_id }-{ system_id }" + def compute_app_consumer_id(system_id): + return f"{ system_id }" def __str__(self): return f"{ self.user.get_username() }-token-{ self.pk }"