@@ -11,6 +11,7 @@ import (
11
11
"code.gitea.io/gitea/models/db"
12
12
"code.gitea.io/gitea/models/unittest"
13
13
user_model "code.gitea.io/gitea/models/user"
14
+ "code.gitea.io/gitea/modules/setting"
14
15
"code.gitea.io/gitea/services/auth/source/oauth2"
15
16
16
17
"github.com/golang-jwt/jwt/v4"
@@ -64,6 +65,24 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
64
65
assert .NoError (t , err )
65
66
assert .Len (t , grants , 1 )
66
67
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
+
67
86
// Scopes: openid profile email
68
87
oidcToken = createAndParseToken (t , grants [0 ])
69
88
assert .Equal (t , user .FullName , oidcToken .Name )
0 commit comments