Skip to content

Commit

Permalink
feat: add face verify on exchange connect token
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron3S committed Dec 16, 2024
1 parent 7419139 commit abad98a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/authentication/api/connection_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ class ExtraActionApiMixin(RDPFileClientProtocolURLMixin):
get_serializer: callable
perform_create: callable
validate_exchange_token: callable
need_face_verify: bool
create_face_verify: callable

@action(methods=['POST', 'GET'], detail=True, url_path='rdp-file')
def get_rdp_file(self, request, *args, **kwargs):
Expand Down Expand Up @@ -314,7 +316,10 @@ def exchange(self, request, *args, **kwargs):
instance.date_expired = date_expired_default()
instance.save()
serializer = self.get_serializer(instance)
return Response(serializer.data, status=status.HTTP_201_CREATED)
response = Response(serializer.data, status=status.HTTP_201_CREATED)
if self.need_face_verify:
self.create_face_verify(response)
return response


class ConnectionTokenViewSet(AuthFaceMixin, ExtraActionApiMixin, RootOrgViewMixin, JMSModelViewSet):
Expand Down Expand Up @@ -429,7 +434,7 @@ def _validate(self, user, asset, account_name, protocol):
data['is_active'] = False
if self.face_monitor_token:
FaceMonitorContext.get_or_create_context(self.face_monitor_token,
self.request.user.id)
self.request.user.id)
data['face_monitor_token'] = self.face_monitor_token
return data

Expand Down

0 comments on commit abad98a

Please sign in to comment.