🚚(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 Anthony LC
parent 004a4edfe7
commit 5f7e3e620a
5 changed files with 5 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
"""Authentication for the Impress core app.""" """Authentication Backends for the Impress core app."""
from django.core.exceptions import SuspiciousOperation from django.core.exceptions import SuspiciousOperation
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@@ -8,7 +8,7 @@ from mozilla_django_oidc.auth import (
OIDCAuthenticationBackend as MozillaOIDCAuthenticationBackend, OIDCAuthenticationBackend as MozillaOIDCAuthenticationBackend,
) )
from .models import User from core.models import User
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 UserFactory from core.factories import UserFactory
pytestmark = pytest.mark.django_db pytestmark = pytest.mark.django_db

View File

@@ -206,7 +206,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 applications from the highest priority to the lowest # Django applications from the highest priority to the lowest