Skip to content

Commit

Permalink
Only create websocket account locally
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Oct 25, 2024
1 parent 7ede6bc commit 4c6f0bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/aap_eda/services/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from itertools import groupby

import jwt
from ansible_base.resource_registry.signals.handlers import no_reverse_sync
from django.conf import settings

from aap_eda.core.models.user import User
Expand Down Expand Up @@ -46,10 +47,11 @@ def create_jwt_token() -> tuple[str, str]:
They can be sent to rulebook clients through command line arguments.
"""
user, new = User.objects.get_or_create(
username="_token_service_user",
is_service_account=True,
)
with no_reverse_sync():
user, new = User.objects.get_or_create(
username="_token_service_user",
is_service_account=True,
)
if new:
user.set_unusable_password()
user.save(update_fields=["password"])
Expand Down

0 comments on commit 4c6f0bf

Please sign in to comment.