🚚(backend) create a dedicated authentication package

Prepare adding advanced authentication features. Create a dedicated
authentication Python package within the core app.

This code organization will be more extensible.
This commit is contained in:
Lebaud Antoine
2024-04-09 23:33:30 +02:00
committed by aleb_the_flash
parent 735db606f6
commit 05d9a09d63
5 changed files with 5 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
"""Authentication for the People core app.""" """Authentication Backends for the People core app."""
from django.conf import settings from django.conf import settings
from django.core.exceptions import SuspiciousOperation from django.core.exceptions import SuspiciousOperation
@@ -10,7 +10,7 @@ from mozilla_django_oidc.auth import (
OIDCAuthenticationBackend as MozillaOIDCAuthenticationBackend, OIDCAuthenticationBackend as MozillaOIDCAuthenticationBackend,
) )
from .models import Identity from core.models import Identity
class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend): class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):

View File

@@ -1,11 +1,11 @@
"""Unit tests for the `get_or_create_user` function.""" """Unit tests for the Authentication Backends."""
from django.core.exceptions import SuspiciousOperation from django.core.exceptions import SuspiciousOperation
import pytest import pytest
from core import models from core import models
from core.authentication import OIDCAuthenticationBackend from core.authentication.backends import OIDCAuthenticationBackend
from core.factories import IdentityFactory from core.factories import IdentityFactory
pytestmark = pytest.mark.django_db pytestmark = pytest.mark.django_db

View File

@@ -182,7 +182,7 @@ class Base(Configuration):
AUTHENTICATION_BACKENDS = [ AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend", "django.contrib.auth.backends.ModelBackend",
"core.authentication.OIDCAuthenticationBackend", "core.authentication.backends.OIDCAuthenticationBackend",
] ]
# Django's applications from the highest priority to the lowest # Django's applications from the highest priority to the lowest