mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:59:15 +02:00
Now persist actors in database during auth
This commit is contained in:
parent
657bd4b01a
commit
81e7f03f77
2 changed files with 5 additions and 3 deletions
|
@ -7,6 +7,7 @@ from rest_framework import exceptions
|
|||
|
||||
from . import actors
|
||||
from . import keys
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import signing
|
||||
from . import utils
|
||||
|
@ -42,7 +43,10 @@ class SignatureAuthentication(authentication.BaseAuthentication):
|
|||
except cryptography.exceptions.InvalidSignature:
|
||||
raise exceptions.AuthenticationFailed('Invalid signature')
|
||||
|
||||
return serializer.build()
|
||||
try:
|
||||
return models.Actor.objects.get(url=actor_data['id'])
|
||||
except models.Actor.DoesNotExist:
|
||||
return serializer.save()
|
||||
|
||||
def authenticate(self, request):
|
||||
setattr(request, 'actor', None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue