Property Mapping - Define a 'source of truth' source that wins when multiple sources are used.
Is your feature request related to a problem?
I've run into a headache where if I use property mappings and then a user write stage, if i don't an expression to strip extraneous data, it overwrites fields that i didn't want updated. Side-note. Property Mappings seem to handle group updates on login without the write stage, but attributes only sync the first time and never again unless I set up a write stage.
Example where I only want discord updating attributes, but not key properties like Username or Name. I'm sure there's a better way to do this, but this was a quick and dirty solution.
from authentik.sources.oauth.models import OAuthSource
if not isinstance(context['source'], OAuthSource) or context['source'].provider_type != "discord":
return True
DOMAIN_TO_SKIP = 'example.org'
if request.context["pending_user"].email.split('@')[-1] == DOMAIN_TO_SKIP:
non_attribute_keys = [ key for key in request.context['prompt_data'] if key != 'attributes' ]
for key in non_attribute_keys:
removed_key = request.context["prompt_data"].pop(key, None)
return TrueDescribe the solution you'd like
A priority list to define which sources are primary, or an option to define what to sync from sources if a value exists alread.
Describe alternatives that you've considered
A hacky shim that just strips out data before doing the write in the auth flow. Seems a little heavy
Additional context
No response
Source: goauthentik/authentik