Skip to content

Commit f122aaf

Browse files
authored
Use better name for userinfo structure (#32544)
1 parent c3dedcf commit f122aaf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

routers/web/auth/oauth2_provider.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ func (err errCallback) Error() string {
8080
}
8181

8282
type userInfoResponse struct {
83-
Sub string `json:"sub"`
84-
Name string `json:"name"`
85-
Username string `json:"preferred_username"`
86-
Email string `json:"email"`
87-
Picture string `json:"picture"`
88-
Groups []string `json:"groups"`
83+
Sub string `json:"sub"`
84+
Name string `json:"name"`
85+
PreferredUsername string `json:"preferred_username"`
86+
Email string `json:"email"`
87+
Picture string `json:"picture"`
88+
Groups []string `json:"groups"`
8989
}
9090

9191
// InfoOAuth manages request for userinfo endpoint
@@ -97,11 +97,11 @@ func InfoOAuth(ctx *context.Context) {
9797
}
9898

9999
response := &userInfoResponse{
100-
Sub: fmt.Sprint(ctx.Doer.ID),
101-
Name: ctx.Doer.FullName,
102-
Username: ctx.Doer.Name,
103-
Email: ctx.Doer.Email,
104-
Picture: ctx.Doer.AvatarLink(ctx),
100+
Sub: fmt.Sprint(ctx.Doer.ID),
101+
Name: ctx.Doer.FullName,
102+
PreferredUsername: ctx.Doer.Name,
103+
Email: ctx.Doer.Email,
104+
Picture: ctx.Doer.AvatarLink(ctx),
105105
}
106106

107107
groups, err := oauth2_provider.GetOAuthGroupsForUser(ctx, ctx.Doer)

0 commit comments

Comments
 (0)