core: set attributes on users which are enrolled via source
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
20c1f15dc0
commit
d85e0593f1
|
@ -34,6 +34,7 @@ from authentik.policies.models import PolicyBindingModel
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
USER_ATTRIBUTE_DEBUG = "goauthentik.io/user/debug"
|
USER_ATTRIBUTE_DEBUG = "goauthentik.io/user/debug"
|
||||||
USER_ATTRIBUTE_SA = "goauthentik.io/user/service-account"
|
USER_ATTRIBUTE_SA = "goauthentik.io/user/service-account"
|
||||||
|
USER_ATTRIBUTE_SOURCES = "goauthentik.io/user/sources"
|
||||||
|
|
||||||
GRAVATAR_URL = "https://secure.gravatar.com"
|
GRAVATAR_URL = "https://secure.gravatar.com"
|
||||||
DEFAULT_AVATAR = static("dist/assets/images/user_default.png")
|
DEFAULT_AVATAR = static("dist/assets/images/user_default.png")
|
||||||
|
|
|
@ -11,6 +11,7 @@ from django.utils.translation import gettext as _
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
|
|
||||||
from authentik.core.models import (
|
from authentik.core.models import (
|
||||||
|
USER_ATTRIBUTE_SOURCES,
|
||||||
Source,
|
Source,
|
||||||
SourceUserMatchingModes,
|
SourceUserMatchingModes,
|
||||||
User,
|
User,
|
||||||
|
@ -269,6 +270,11 @@ class SourceFlowManager:
|
||||||
if not self.source.enrollment_flow:
|
if not self.source.enrollment_flow:
|
||||||
self._logger.warning("source has no enrollment flow")
|
self._logger.warning("source has no enrollment flow")
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
if USER_ATTRIBUTE_SOURCES not in self.enroll_info or not isinstance(
|
||||||
|
self.enroll_info[USER_ATTRIBUTE_SOURCES], list
|
||||||
|
):
|
||||||
|
self.enroll_info[USER_ATTRIBUTE_SOURCES] = []
|
||||||
|
self.enroll_info[USER_ATTRIBUTE_SOURCES].append(self.source.name)
|
||||||
return self._handle_login_flow(
|
return self._handle_login_flow(
|
||||||
self.source.enrollment_flow,
|
self.source.enrollment_flow,
|
||||||
**{
|
**{
|
||||||
|
|
Reference in New Issue