"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
- "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/oauth2_provider"
"github.com/golang-jwt/jwt/v5"
// Scopes: openid profile email
oidcToken = createAndParseToken(t, grants[0])
- assert.Equal(t, user.Name, oidcToken.Name)
- assert.Equal(t, user.Name, oidcToken.PreferredUsername)
- assert.Equal(t, user.HTMLURL(), oidcToken.Profile)
- assert.Equal(t, user.AvatarLink(db.DefaultContext), oidcToken.Picture)
- assert.Equal(t, user.Website, oidcToken.Website)
- assert.Equal(t, user.UpdatedUnix, oidcToken.UpdatedAt)
- assert.Equal(t, user.Email, oidcToken.Email)
- assert.Equal(t, user.IsActive, oidcToken.EmailVerified)
-
- // set DefaultShowFullName to true
- oldDefaultShowFullName := setting.UI.DefaultShowFullName
- setting.UI.DefaultShowFullName = true
- defer func() {
- setting.UI.DefaultShowFullName = oldDefaultShowFullName
- }()
-
- // Scopes: openid profile email
- oidcToken = createAndParseToken(t, grants[0])
- assert.Equal(t, user.FullName, oidcToken.Name)
+ assert.Equal(t, user.DisplayName(), oidcToken.Name)
assert.Equal(t, user.Name, oidcToken.PreferredUsername)
assert.Equal(t, user.HTMLURL(), oidcToken.Profile)
assert.Equal(t, user.AvatarLink(db.DefaultContext), oidcToken.Picture)