Skip to content

Commit b7872c1

Browse files
authored
Remove deprecated and unused getPortAuthenticationToken method (#17321)
1 parent d069f76 commit b7872c1

31 files changed

+25
-84
lines changed

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ type APIInterface interface {
3636
GetConfiguration(ctx context.Context) (res *Configuration, err error)
3737
GetGitpodTokenScopes(ctx context.Context, tokenHash string) (res []string, err error)
3838
GetToken(ctx context.Context, query *GetTokenSearchOptions) (res *Token, err error)
39-
GetPortAuthenticationToken(ctx context.Context, workspaceID string) (res *Token, err error)
4039
DeleteAccount(ctx context.Context) (err error)
4140
GetClientRegion(ctx context.Context) (res string, err error)
4241
HasPermission(ctx context.Context, permission *PermissionName) (res bool, err error)
@@ -134,8 +133,6 @@ const (
134133
FunctionGetGitpodTokenScopes FunctionName = "getGitpodTokenScopes"
135134
// FunctionGetToken is the name of the getToken function
136135
FunctionGetToken FunctionName = "getToken"
137-
// FunctionGetPortAuthenticationToken is the name of the getPortAuthenticationToken function
138-
FunctionGetPortAuthenticationToken FunctionName = "getPortAuthenticationToken"
139136
// FunctionDeleteAccount is the name of the deleteAccount function
140137
FunctionDeleteAccount FunctionName = "deleteAccount"
141138
// FunctionGetClientRegion is the name of the getClientRegion function
@@ -597,26 +594,6 @@ func (gp *APIoverJSONRPC) GetToken(ctx context.Context, query *GetTokenSearchOpt
597594
return
598595
}
599596

600-
// GetPortAuthenticationToken calls getPortAuthenticationToken on the server
601-
func (gp *APIoverJSONRPC) GetPortAuthenticationToken(ctx context.Context, workspaceID string) (res *Token, err error) {
602-
if gp == nil {
603-
err = errNotConnected
604-
return
605-
}
606-
var _params []interface{}
607-
608-
_params = append(_params, workspaceID)
609-
610-
var result Token
611-
err = gp.C.Call(ctx, "getPortAuthenticationToken", _params, &result)
612-
if err != nil {
613-
return
614-
}
615-
res = &result
616-
617-
return
618-
}
619-
620597
// DeleteAccount calls deleteAccount on the server
621598
func (gp *APIoverJSONRPC) DeleteAccount(ctx context.Context) (err error) {
622599
if gp == nil {

components/gitpod-protocol/go/mock.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
8686
getConfiguration(): Promise<Configuration>;
8787
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
8888
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
89-
/**
90-
* @deprecated
91-
*/
92-
getPortAuthenticationToken(workspaceId: string): Promise<Token>;
9389
deleteAccount(): Promise<void>;
9490
getClientRegion(): Promise<string | undefined>;
9591
hasPermission(permission: PermissionName): Promise<boolean>;

components/server/src/auth/rate-limiter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const defaultFunctions: FunctionsConfig = {
5858
getConfiguration: { group: "default", points: 1 },
5959
getGitpodTokenScopes: { group: "default", points: 1 },
6060
getToken: { group: "default", points: 1 },
61-
getPortAuthenticationToken: { group: "default", points: 1 },
6261
deleteAccount: { group: "default", points: 1 },
6362
getClientRegion: { group: "default", points: 1 },
6463
hasPermission: { group: "default", points: 1 },

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -633,21 +633,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
633633
}
634634
}
635635

636-
public async getPortAuthenticationToken(ctx: TraceContext, workspaceId: string): Promise<Token> {
637-
traceAPIParams(ctx, { workspaceId });
638-
traceWI(ctx, { workspaceId });
639-
640-
const user = this.checkAndBlockUser("getPortAuthenticationToken", { workspaceId });
641-
642-
const workspace = await this.workspaceDb.trace(ctx).findById(workspaceId);
643-
await this.guardAccess({ kind: "workspace", subject: workspace! }, "get");
644-
645-
const token = await this.tokenProvider.getFreshPortAuthenticationToken(user, workspaceId);
646-
await this.guardAccess({ kind: "token", subject: token, tokenOwnerID: user.id }, "create");
647-
648-
return token;
649-
}
650-
651636
public async deleteAccount(ctx: TraceContext): Promise<void> {
652637
const user = this.checkAndBlockUser("deleteAccount");
653638
await this.guardAccess({ kind: "user", subject: user! }, "delete");

components/server/src/workspace/workspace-starter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,6 @@ export class WorkspaceStarter {
15281528
const scopes = [
15291529
"function:getWorkspace",
15301530
"function:getLoggedInUser",
1531-
"function:getPortAuthenticationToken",
15321531
"function:getWorkspaceOwner",
15331532
"function:getWorkspaceUsers",
15341533
"function:isWorkspaceOwner",

components/ws-manager/pkg/manager/testdata/status_cannotPull_004_CREATING00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@
692692
},
693693
{
694694
"name": "THEIA_SUPERVISOR_TOKENS",
695-
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getPortAuthenticationToken\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::silver-dormouse-is733prg::get/update\",\"resource:workspaceInstance::5031df46-db5e-43ae-91bd-1448305c001d::get/update/delete\",\"resource:snapshot::ws-silver-dormouse-is733prg::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::/::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T11:14:35.921Z\",\"reuse\":2}]"
695+
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::silver-dormouse-is733prg::get/update\",\"resource:workspaceInstance::5031df46-db5e-43ae-91bd-1448305c001d::get/update/delete\",\"resource:snapshot::ws-silver-dormouse-is733prg::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::/::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T11:14:35.921Z\",\"reuse\":2}]"
696696
},
697697
{
698698
"value": "30000",

components/ws-manager/pkg/manager/testdata/status_cannotPull_005_STOPPED00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@
543543
},
544544
{
545545
"name": "THEIA_SUPERVISOR_TOKENS",
546-
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getPortAuthenticationToken\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::silver-dormouse-is733prg::get/update\",\"resource:workspaceInstance::5031df46-db5e-43ae-91bd-1448305c001d::get/update/delete\",\"resource:snapshot::ws-silver-dormouse-is733prg::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::/::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T11:14:35.921Z\",\"reuse\":2}]"
546+
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::silver-dormouse-is733prg::get/update\",\"resource:workspaceInstance::5031df46-db5e-43ae-91bd-1448305c001d::get/update/delete\",\"resource:snapshot::ws-silver-dormouse-is733prg::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::/::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T11:14:35.921Z\",\"reuse\":2}]"
547547
},
548548
{
549549
"name": "GITPOD_INTERVAL",

components/ws-manager/pkg/manager/testdata/status_containerd4214_STOPPING00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
},
152152
{
153153
"name": "THEIA_SUPERVISOR_TOKENS",
154-
"value": "[{\"tokenOTS\":\"https://cw-wsdaemon-patch.staging.gitpod-dev.com/api/ots/get/2eae8c00-6b75-47b4-bf10-f1b9b6d96eec\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"cw-wsdaemon-patch.staging.gitpod-dev.com\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getPortAuthenticationToken\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"resource:workspace::amber-swallow-sbhsd9w0::get/update\",\"resource:workspaceInstance::cc1a3979-4e0e-42cc-bba5-a8d66485bdee::get/update/delete\",\"resource:snapshot::ws-amber-swallow-sbhsd9w0::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\"],\"expiryDate\":\"2021-03-30T07:55:36.098Z\",\"reuse\":2}]"
154+
"value": "[{\"tokenOTS\":\"https://cw-wsdaemon-patch.staging.gitpod-dev.com/api/ots/get/2eae8c00-6b75-47b4-bf10-f1b9b6d96eec\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"cw-wsdaemon-patch.staging.gitpod-dev.com\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"resource:workspace::amber-swallow-sbhsd9w0::get/update\",\"resource:workspaceInstance::cc1a3979-4e0e-42cc-bba5-a8d66485bdee::get/update/delete\",\"resource:snapshot::ws-amber-swallow-sbhsd9w0::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\"],\"expiryDate\":\"2021-03-30T07:55:36.098Z\",\"reuse\":2}]"
155155
},
156156
{
157157
"name": "GITPOD_RESOLVED_EXTENSIONS",

components/ws-manager/pkg/manager/testdata/status_contentInitFailed_005_STOPPED00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
},
487487
{
488488
"name": "THEIA_SUPERVISOR_TOKENS",
489-
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getPortAuthenticationToken\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::aqua-chimpanzee-35q6f08k::get/update\",\"resource:workspaceInstance::50bff6fd-2b1f-4d33-8b74-5362739add6f::get/update/delete\",\"resource:snapshot::ws-aqua-chimpanzee-35q6f08k::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::gitlab-org/gitlab::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T12:07:50.216Z\",\"reuse\":2}]"
489+
"value": "[{\"tokenOTS\":\"\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"gitpod.io\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"function:guessGitTokenScopes\",\"function:getEnvVars\",\"function:setEnvVar\",\"function:deleteEnvVar\",\"function:trackEvent\",\"resource:workspace::aqua-chimpanzee-35q6f08k::get/update\",\"resource:workspaceInstance::50bff6fd-2b1f-4d33-8b74-5362739add6f::get/update/delete\",\"resource:snapshot::ws-aqua-chimpanzee-35q6f08k::create\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\",\"resource:envVar::gitlab-org/gitlab::create/get/update/delete\"],\"expiryDate\":\"2021-08-20T12:07:50.216Z\",\"reuse\":2}]"
490490
},
491491
{
492492
"name": "GITPOD_RESOLVED_EXTENSIONS",

components/ws-manager/pkg/manager/testdata/status_disposal_STOPPED01.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
},
135135
{
136136
"name": "THEIA_SUPERVISOR_TOKENS",
137-
"value": "[{\"tokenOTS\":\"https://cw-no-plis.staging.gitpod-dev.com/api/ots/get/e82f0679-fd49-4da8-8af5-eb8da685ab98\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"cw-no-plis.staging.gitpod-dev.com\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getPortAuthenticationToken\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"resource:workspace::green-mosquito-gvkloyfy::get/update\",\"resource:workspaceInstance::60a694b3-ac7d-4a24-8ad9-2d8d5eb56de0::get/update/delete\",\"resource:snapshot::*::create/get\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\"],\"expiryDate\":\"2021-03-20T08:34:32.325Z\",\"reuse\":2}]"
137+
"value": "[{\"tokenOTS\":\"https://cw-no-plis.staging.gitpod-dev.com/api/ots/get/e82f0679-fd49-4da8-8af5-eb8da685ab98\",\"token\":\"ots\",\"kind\":\"gitpod\",\"host\":\"cw-no-plis.staging.gitpod-dev.com\",\"scope\":[\"function:getWorkspace\",\"function:getLoggedInUser\",\"function:getWorkspaceOwner\",\"function:getWorkspaceUsers\",\"function:isWorkspaceOwner\",\"function:controlAdmission\",\"function:setWorkspaceTimeout\",\"function:getWorkspaceTimeout\",\"function:sendHeartBeat\",\"function:getOpenPorts\",\"function:openPort\",\"function:closePort\",\"function:getLayout\",\"function:generateNewGitpodToken\",\"function:takeSnapshot\",\"function:storeLayout\",\"function:stopWorkspace\",\"function:getToken\",\"function:getContentBlobUploadUrl\",\"function:getContentBlobDownloadUrl\",\"function:accessCodeSyncStorage\",\"resource:workspace::green-mosquito-gvkloyfy::get/update\",\"resource:workspaceInstance::60a694b3-ac7d-4a24-8ad9-2d8d5eb56de0::get/update/delete\",\"resource:snapshot::*::create/get\",\"resource:gitpodToken::*::create\",\"resource:userStorage::*::create/get/update\",\"resource:token::*::get\",\"resource:contentBlob::*::create/get\"],\"expiryDate\":\"2021-03-20T08:34:32.325Z\",\"reuse\":2}]"
138138
},
139139
{
140140
"name": "GITPOD_RESOLVED_EXTENSIONS",

0 commit comments

Comments
 (0)