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

Added display_name_claim in jwt_config which sets the user's display name upon registration #17708

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

EnneS
Copy link
Contributor

@EnneS EnneS commented Sep 13, 2024

Added the display_name_claim option to the JWT configuration. This option allows specifying the claim key that contains the user's display name in the JWT payload.

Pull Request Checklist

  • [] Pull request is based on the develop branch
  • [] Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • [] Code style is correct
    (run the linters)

@EnneS EnneS requested a review from a team as a code owner September 13, 2024 09:09
@github-actions github-actions bot deployed to PR Documentation Preview October 7, 2024 08:31 Active
@github-actions github-actions bot deployed to PR Documentation Preview October 9, 2024 11:53 Active
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @EnneS, and apologies for the slow review. I've gone ahead and added a unit test for the newly added option so we can ensure it doesn't break in the future.


For the benefit of others: the JWT login method is non-standard, and as such we can change it without needing a Matrix Spec Change. Likewise JWT's allow adding any fields you like to them in addition to the specified ones.

The new display_name_claim option allows setting the name of the field inside the JWT payload which is expected to contain a display_name. This will only be checked on the first login of a user.

Everything checks out, thank you!

synapse/handlers/jwt.py Outdated Show resolved Hide resolved
@anoadragon453 anoadragon453 enabled auto-merge (squash) October 9, 2024 11:53
@github-actions github-actions bot deployed to PR Documentation Preview October 9, 2024 11:54 Active
@anoadragon453 anoadragon453 merged commit 05576f0 into element-hq:develop Oct 9, 2024
41 checks passed
@col-panic
Copy link

Just did an issue on this #17807 - what a coincidence!

@EnneS
Copy link
Contributor Author

EnneS commented Oct 9, 2024

Cheers (;

@col-panic
Copy link

Why isn't this mentioned in the release documentation?

@anoadragon453
Copy link
Member

anoadragon453 commented Oct 15, 2024

@col-panic I'm not sure what you mean, but when this is released in Synapse v1.118 the newsfile for this change will appear in the changelog and release notes.

Edit: perhaps the confusion is that the first release candidate for Synapse v1.117 was cut on October 8th, a day before this PR was merged. This change will be there in Synapse v1.118rc1, due on October 22nd, and in the full release a week later!

@col-panic
Copy link

@anoadragon453 oh ok, thank you very much, I just saw the commit that already went in, and assumed that it was forgotten!

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.

3 participants