Page MenuHomeSoftware Heritage

D5310.id.diff
No OneTemporary

D5310.id.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,4 +1,4 @@
-swh.auth >= 0.3.4
+swh.auth[django] >= 0.3.7
swh.core >= 0.0.95
swh.indexer >= 0.4.1
swh.model >= 0.5.0
diff --git a/swh/web/auth/backends.py b/swh/web/auth/backends.py
--- a/swh/web/auth/backends.py
+++ b/swh/web/auth/backends.py
@@ -15,7 +15,7 @@
from rest_framework.authentication import BaseAuthentication
from rest_framework.exceptions import AuthenticationFailed, ValidationError
-from swh.web.auth.models import OIDCUser
+from swh.auth.django.models import OIDCUser
from swh.web.auth.utils import get_oidc_client
diff --git a/swh/web/auth/models.py b/swh/web/auth/models.py
--- a/swh/web/auth/models.py
+++ b/swh/web/auth/models.py
@@ -5,23 +5,6 @@
from django.db import models
-from swh.auth.django.models import OIDCUser as OIDCUserBase
-
-
-class OIDCUser(OIDCUserBase):
- """
- Custom User proxy model for remote users storing OpenID Connect
- related data: profile containing authentication tokens.
-
- The model is also not saved to database as all users are already stored
- in the Keycloak one.
- """
-
- class Meta:
- app_label = "swh_web_auth"
- proxy = True
- auto_created = True # prevent model to be created in database by migrations
-
class OIDCUserOfflineTokens(models.Model):
"""
diff --git a/swh/web/auth/views.py b/swh/web/auth/views.py
--- a/swh/web/auth/views.py
+++ b/swh/web/auth/views.py
@@ -24,7 +24,8 @@
from django.shortcuts import render
from django.views.decorators.http import require_http_methods
-from swh.web.auth.models import OIDCUser, OIDCUserOfflineTokens
+from swh.auth.django.models import OIDCUser
+from swh.web.auth.models import OIDCUserOfflineTokens
from swh.web.auth.utils import (
decrypt_data,
encrypt_data,
diff --git a/swh/web/tests/auth/test_api_auth.py b/swh/web/tests/auth/test_api_auth.py
--- a/swh/web/tests/auth/test_api_auth.py
+++ b/swh/web/tests/auth/test_api_auth.py
@@ -7,7 +7,7 @@
from django.contrib.auth.models import AnonymousUser, User
-from swh.web.auth.models import OIDCUser
+from swh.auth.django.models import OIDCUser
from swh.web.common.utils import reverse
from swh.web.tests.utils import check_api_get_responses, check_http_get_response
diff --git a/swh/web/tests/auth/test_backends.py b/swh/web/tests/auth/test_backends.py
--- a/swh/web/tests/auth/test_backends.py
+++ b/swh/web/tests/auth/test_backends.py
@@ -12,8 +12,8 @@
from django.contrib.auth import authenticate, get_backends
from rest_framework.exceptions import AuthenticationFailed
+from swh.auth.django.models import OIDCUser
from swh.web.auth.backends import OIDCBearerTokenAuthentication
-from swh.web.auth.models import OIDCUser
from swh.web.common.utils import reverse
diff --git a/swh/web/tests/auth/test_views.py b/swh/web/tests/auth/test_views.py
--- a/swh/web/tests/auth/test_views.py
+++ b/swh/web/tests/auth/test_views.py
@@ -12,7 +12,8 @@
from django.contrib.auth.models import AnonymousUser, User
from django.http import QueryDict
-from swh.web.auth.models import OIDCUser, OIDCUserOfflineTokens
+from swh.auth.django.models import OIDCUser
+from swh.web.auth.models import OIDCUserOfflineTokens
from swh.web.auth.utils import OIDC_SWH_WEB_CLIENT_ID, decrypt_data
from swh.web.common.utils import reverse
from swh.web.config import get_config

File Metadata

Mime Type
text/plain
Expires
Mar 17 2025, 6:54 PM (7 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224231

Event Timeline