Skip to content

Commit 2ad311a

Browse files
authored
[server] FIx missing User.fullName attribute for SSO users – EXP-365 (#18445)
* [server] FIx missing User.fullName attribute for SSO users Git config prefers `User.fullName` for `git config user.name`, see https://github.com/gitpod-io/gitpod/blob/24f7b609bf79b247d72d1841282639726bcd5891/components/server/src/workspace/workspace-starter.ts#L550 This PR should re-add this values. Users would have to re-login to get this updated. * fixup test
1 parent 19a3fff commit 2ad311a

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

components/server/src/iam/iam-oidc-create-session-payload.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export interface OIDCCreateSessionPayload {
7171
Expiry: string; // "2023-01-10T12:00:00Z",
7272
IssuedAt: string; // "2023-01-01T12:00:00Z",
7373
};
74+
/**
75+
* https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
76+
*/
7477
claims: {
7578
aud: string;
7679
email: string;
@@ -80,10 +83,16 @@ export interface OIDCCreateSessionPayload {
8083
hd?: string; // accepted domain, e.g. "gitpod.io"
8184
iss: string; // "https://accounts.google.com"
8285
locale: string; // e.g. "de"
86+
/**
87+
* End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.
88+
*/
8389
name: string;
8490
picture: string; // URL of avatar
91+
/**
92+
* Subject - Identifier for the End-User at the Issuer.
93+
*/
8594
sub: string; // "1234567890"
8695
};
87-
organizationId: string; // TODO(gpl) Remove once we implemented either SKIM, or a proper UserService
96+
organizationId: string;
8897
oidcClientConfigId: string;
8998
}

components/server/src/iam/iam-session-app.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class TestIamSessionApp {
4242
createUser: (params) => {
4343
return { id: "id-new-user" } as any;
4444
},
45+
updateUser: (userId, update) => {
46+
return {} as any;
47+
},
4548
};
4649
protected userAuthenticationMock: Partial<UserAuthentication> = {
4750
findUserForLogin: async (params) => {

components/server/src/iam/iam-session-app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ export class IamSessionApp {
128128
primaryEmail: recent.primaryEmail,
129129
lastSigninTime: new Date().toISOString(),
130130
});
131+
await this.userService.updateUser(user.id, {
132+
id: user.id,
133+
fullName: payload.claims.name,
134+
});
131135
}
132136
}
133137

@@ -141,6 +145,7 @@ export class IamSessionApp {
141145
organizationId,
142146
identity: { ...this.mapOIDCProfileToIdentity(payload), lastSigninTime: new Date().toISOString() },
143147
userUpdate: (user) => {
148+
user.fullName = claims.name;
144149
user.name = claims.name;
145150
user.avatarUrl = claims.picture;
146151
},

0 commit comments

Comments
 (0)