@@ -11,6 +11,7 @@ import (
1111 "code.gitea.io/gitea/models/db"
1212 "code.gitea.io/gitea/models/unittest"
1313 user_model "code.gitea.io/gitea/models/user"
14+ "code.gitea.io/gitea/modules/setting"
1415 "code.gitea.io/gitea/services/auth/source/oauth2"
1516
1617 "github.com/golang-jwt/jwt/v4"
@@ -64,6 +65,24 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
6465 assert .NoError (t , err )
6566 assert .Len (t , grants , 1 )
6667
68+ // Scopes: openid profile email
69+ oidcToken = createAndParseToken (t , grants [0 ])
70+ assert .Equal (t , user .Name , oidcToken .Name )
71+ assert .Equal (t , user .Name , oidcToken .PreferredUsername )
72+ assert .Equal (t , user .HTMLURL (), oidcToken .Profile )
73+ assert .Equal (t , user .AvatarLink (), oidcToken .Picture )
74+ assert .Equal (t , user .Website , oidcToken .Website )
75+ assert .Equal (t , user .UpdatedUnix , oidcToken .UpdatedAt )
76+ assert .Equal (t , user .Email , oidcToken .Email )
77+ assert .Equal (t , user .IsActive , oidcToken .EmailVerified )
78+
79+ // set DefaultShowFullName to true
80+ oldDefaultShowFullName := setting .UI .DefaultShowFullName
81+ setting .UI .DefaultShowFullName = true
82+ defer func () {
83+ setting .UI .DefaultShowFullName = oldDefaultShowFullName
84+ }()
85+
6786 // Scopes: openid profile email
6887 oidcToken = createAndParseToken (t , grants [0 ])
6988 assert .Equal (t , user .FullName , oidcToken .Name )
0 commit comments