authentik.enterprise.providers.scim.api

 1from django.utils.translation import gettext as _
 2from rest_framework.exceptions import ValidationError
 3
 4from authentik.enterprise.license import LicenseKey
 5from authentik.providers.scim.models import SCIMAuthenticationMode
 6
 7
 8class SCIMProviderSerializerMixin:
 9
10    def validate_auth_mode(self, auth_mode: SCIMAuthenticationMode) -> SCIMAuthenticationMode:
11        if auth_mode == SCIMAuthenticationMode.OAUTH:
12            if not LicenseKey.cached_summary().status.is_valid:
13                raise ValidationError(_("Enterprise is required to use the OAuth mode."))
14        return auth_mode
class SCIMProviderSerializerMixin:
 9class SCIMProviderSerializerMixin:
10
11    def validate_auth_mode(self, auth_mode: SCIMAuthenticationMode) -> SCIMAuthenticationMode:
12        if auth_mode == SCIMAuthenticationMode.OAUTH:
13            if not LicenseKey.cached_summary().status.is_valid:
14                raise ValidationError(_("Enterprise is required to use the OAuth mode."))
15        return auth_mode
11    def validate_auth_mode(self, auth_mode: SCIMAuthenticationMode) -> SCIMAuthenticationMode:
12        if auth_mode == SCIMAuthenticationMode.OAUTH:
13            if not LicenseKey.cached_summary().status.is_valid:
14                raise ValidationError(_("Enterprise is required to use the OAuth mode."))
15        return auth_mode