go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.29k stars 5.51k forks source link

Use user.FullName in Oauth2 id_token response #32542

Closed baltitenger closed 1 week ago

baltitenger commented 1 week ago

This makes /login/oauth/authorize behave the same way as the /login/oauth/userinfo endpoint.

lunny commented 1 week ago

But FullName maybe empty

baltitenger commented 1 week ago

Then I guess the userinfo handler should be changed to work the same way, or both changed to use FullName with a fallback to Name

baltitenger commented 1 week ago

Oh wtf, there's DisplayName and GetDisplayName... Would using DisplayName in both places be fine?

lunny commented 1 week ago

I think both needs to be changed to use DisplayName, because it implemented a fallback if Fullname is empty.

wxiaoguang commented 1 week ago

Thank you for the PR!

It seems that DisplayName/GetDisplayName/FullName these names are too ambiguous .... I will try to make some improvements in this PR together to make them easier for contributors to understand