Skip to content

Commit 72a58dd

Browse files
authored
[server] Fix userService.deauthorize to disallow disconnecting the last auth provider (#17022)
1 parent 8871aed commit 72a58dd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

components/server/src/user/user-service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ export class UserService {
461461
}
462462

463463
async deauthorize(user: User, authProviderId: string) {
464-
const builtInProviders = ["Public-GitLab", "Public-GitHub", "Public-Bitbucket"];
465464
const externalIdentities = user.identities.filter(
466465
(i) => i.authProviderId !== TokenService.GITPOD_AUTH_PROVIDER_ID,
467466
);
@@ -476,10 +475,8 @@ export class UserService {
476475
(i) => i !== identity && (!this.config.disableDynamicAuthProviderLogin || isBuiltin(i.authProviderId)),
477476
);
478477

479-
if (
480-
remainingLoginIdentities.length === 1 &&
481-
!builtInProviders.includes(remainingLoginIdentities[0].authProviderId)
482-
) {
478+
// Disallow users to deregister the last builtin auth provider's from their user
479+
if (remainingLoginIdentities.length === 0) {
483480
throw new Error(
484481
"Cannot remove last authentication provider for logging in to Gitpod. Please delete account if you want to leave.",
485482
);

0 commit comments

Comments
 (0)