Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing username when creating user through OIDC #971

Merged
merged 6 commits into from
Jan 30, 2025

Conversation

kyuuk
Copy link
Contributor

@kyuuk kyuuk commented Jan 29, 2025

Fixes #793

Allow config of oidc claim used for username generation (default to email claim to avoid breaking existing installs)

@@ -128,10 +129,16 @@ def redirect_with_query(request, redirect_url):
return HttpResponseRedirect(redirect_url)


def generate_username(email):
def generate_username(email, claims):
Copy link
Contributor Author

@kyuuk kyuuk Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the record, the mozilla-django-oidc documentation is not up to date with the code, this function can actually have 2 args
https://github.com/mozilla/mozilla-django-oidc/blob/main/mozilla_django_oidc/auth.py#L120

@sissbruecker sissbruecker changed the title Add ability to cutomize claim used for username generation on oidc login Allow customizing username when creating user through OIDC Jan 30, 2025
@sissbruecker sissbruecker merged commit 2973812 into sissbruecker:master Jan 30, 2025
2 checks passed
@kyuuk kyuuk deleted the oidc_cutomizable_username branch January 30, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OIDC: Option for Username instead of Email
2 participants