Skip to content

Commit bd2cbcc

Browse files
committed
fixup: updateAuthProvider
1 parent 1010fde commit bd2cbcc

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

components/gitpod-protocol/src/gitpod-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
104104
/** @deprecated used for public-api compatibility only */
105105
deleteAuthProvider(id: string): Promise<void>;
106106
/** @deprecated used for public-api compatibility only */
107-
updateAuthProvider(id: string, update: AuthProviderEntry.UpdateEntry): Promise<AuthProviderEntry>;
107+
updateAuthProvider(id: string, update: AuthProviderEntry.UpdateOAuth2Config): Promise<AuthProviderEntry>;
108108

109109
// Query/retrieve workspaces
110110
getWorkspaces(options: GitpodServer.GetWorkspacesOptions): Promise<WorkspaceInfo[]>;

components/gitpod-protocol/src/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,7 @@ export namespace AuthProviderEntry {
15881588
clientSecret: string;
15891589
organizationId: string;
15901590
};
1591+
export type UpdateOAuth2Config = Pick<OAuth2Config, "clientId" | "clientSecret">;
15911592
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
15921593
return {
15931594
...entry,

components/server/src/workspace/gitpod-server-impl.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
31543154
async updateAuthProvider(
31553155
ctx: TraceContextWithSpan,
31563156
id: string,
3157-
entry: AuthProviderEntry.UpdateEntry,
3157+
update: AuthProviderEntry.UpdateOAuth2Config,
31583158
): Promise<AuthProviderEntry> {
31593159
traceAPIParams(ctx, { id });
31603160

@@ -3167,10 +3167,22 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
31673167

31683168
if (authProvider.organizationId) {
31693169
return this.updateOrgAuthProvider(ctx, {
3170-
entry: { ...entry, organizationId: authProvider.organizationId },
3170+
entry: {
3171+
organizationId: authProvider.organizationId,
3172+
id: authProvider.id,
3173+
clientId: update.clientId,
3174+
clientSecret: update.clientSecret,
3175+
},
31713176
});
31723177
} else {
3173-
return this.updateOwnAuthProvider(ctx, { entry });
3178+
return this.updateOwnAuthProvider(ctx, {
3179+
entry: {
3180+
id: authProvider.id,
3181+
clientId: update.clientId,
3182+
clientSecret: update.clientSecret,
3183+
ownerId: user.id,
3184+
},
3185+
});
31743186
}
31753187
}
31763188

0 commit comments

Comments
 (0)