Skip to content

Commit

Permalink
♻️ [#83] Move choices constant into constants.py
Browse files Browse the repository at this point in the history
Preparing to add additional constants definitions.
  • Loading branch information
sergei-maertens committed Feb 6, 2024
1 parent 050d8bc commit 3678430
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion mozilla_django_oidc_db/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
OIDCAuthenticationBackend as _OIDCAuthenticationBackend,
)

from .constants import UserInformationClaimsSources
from .mixins import GetAttributeMixin, SoloConfigMixin
from .models import OpenIDConnectConfig, UserInformationClaimsSources
from .models import OpenIDConnectConfig
from .utils import obfuscate_claims

logger = logging.getLogger(__name__)
Expand Down
8 changes: 8 additions & 0 deletions mozilla_django_oidc_db/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

# Mapping the configuration model fieldnames for endpoints to their
# corresponding names in the OIDC spec
OIDC_MAPPING = {
Expand All @@ -8,3 +11,8 @@
}

OPEN_ID_CONFIG_PATH = ".well-known/openid-configuration"


class UserInformationClaimsSources(models.TextChoices):
userinfo_endpoint = "userinfo_endpoint", _("Userinfo endpoint")
id_token = "id_token", _("ID token")
6 changes: 1 addition & 5 deletions mozilla_django_oidc_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
import mozilla_django_oidc_db.settings as oidc_settings

from .compat import classproperty


class UserInformationClaimsSources(models.TextChoices):
userinfo_endpoint = "userinfo_endpoint", _("Userinfo endpoint")
id_token = "id_token", _("ID token")
from .constants import UserInformationClaimsSources


def get_default_scopes() -> List[str]:
Expand Down

0 comments on commit 3678430

Please sign in to comment.