Skip to content

🧹 Remove deprecated and unused getPortAuthenticationToken method #17321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type APIInterface interface {
GetConfiguration(ctx context.Context) (res *Configuration, err error)
GetGitpodTokenScopes(ctx context.Context, tokenHash string) (res []string, err error)
GetToken(ctx context.Context, query *GetTokenSearchOptions) (res *Token, err error)
GetPortAuthenticationToken(ctx context.Context, workspaceID string) (res *Token, err error)
DeleteAccount(ctx context.Context) (err error)
GetClientRegion(ctx context.Context) (res string, err error)
HasPermission(ctx context.Context, permission *PermissionName) (res bool, err error)
Expand Down Expand Up @@ -134,8 +133,6 @@ const (
FunctionGetGitpodTokenScopes FunctionName = "getGitpodTokenScopes"
// FunctionGetToken is the name of the getToken function
FunctionGetToken FunctionName = "getToken"
// FunctionGetPortAuthenticationToken is the name of the getPortAuthenticationToken function
FunctionGetPortAuthenticationToken FunctionName = "getPortAuthenticationToken"
// FunctionDeleteAccount is the name of the deleteAccount function
FunctionDeleteAccount FunctionName = "deleteAccount"
// FunctionGetClientRegion is the name of the getClientRegion function
Expand Down Expand Up @@ -597,26 +594,6 @@ func (gp *APIoverJSONRPC) GetToken(ctx context.Context, query *GetTokenSearchOpt
return
}

// GetPortAuthenticationToken calls getPortAuthenticationToken on the server
func (gp *APIoverJSONRPC) GetPortAuthenticationToken(ctx context.Context, workspaceID string) (res *Token, err error) {
if gp == nil {
err = errNotConnected
return
}
var _params []interface{}

_params = append(_params, workspaceID)

var result Token
err = gp.C.Call(ctx, "getPortAuthenticationToken", _params, &result)
if err != nil {
return
}
res = &result

return
}

// DeleteAccount calls deleteAccount on the server
func (gp *APIoverJSONRPC) DeleteAccount(ctx context.Context) (err error) {
if gp == nil {
Expand Down
15 changes: 0 additions & 15 deletions components/gitpod-protocol/go/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions components/gitpod-protocol/src/gitpod-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
getConfiguration(): Promise<Configuration>;
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
/**
* @deprecated
*/
getPortAuthenticationToken(workspaceId: string): Promise<Token>;
deleteAccount(): Promise<void>;
getClientRegion(): Promise<string | undefined>;
hasPermission(permission: PermissionName): Promise<boolean>;
Expand Down
1 change: 0 additions & 1 deletion components/server/src/auth/rate-limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const defaultFunctions: FunctionsConfig = {
getConfiguration: { group: "default", points: 1 },
getGitpodTokenScopes: { group: "default", points: 1 },
getToken: { group: "default", points: 1 },
getPortAuthenticationToken: { group: "default", points: 1 },
deleteAccount: { group: "default", points: 1 },
getClientRegion: { group: "default", points: 1 },
hasPermission: { group: "default", points: 1 },
Expand Down
15 changes: 0 additions & 15 deletions components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,21 +633,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
}
}

public async getPortAuthenticationToken(ctx: TraceContext, workspaceId: string): Promise<Token> {
traceAPIParams(ctx, { workspaceId });
traceWI(ctx, { workspaceId });

const user = this.checkAndBlockUser("getPortAuthenticationToken", { workspaceId });

const workspace = await this.workspaceDb.trace(ctx).findById(workspaceId);
await this.guardAccess({ kind: "workspace", subject: workspace! }, "get");

const token = await this.tokenProvider.getFreshPortAuthenticationToken(user, workspaceId);
await this.guardAccess({ kind: "token", subject: token, tokenOwnerID: user.id }, "create");

return token;
}

public async deleteAccount(ctx: TraceContext): Promise<void> {
const user = this.checkAndBlockUser("deleteAccount");
await this.guardAccess({ kind: "user", subject: user! }, "delete");
Expand Down
1 change: 0 additions & 1 deletion components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,6 @@ export class WorkspaceStarter {
const scopes = [
"function:getWorkspace",
"function:getLoggedInUser",
"function:getPortAuthenticationToken",
"function:getWorkspaceOwner",
"function:getWorkspaceUsers",
"function:isWorkspaceOwner",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
},
{
"name": "THEIA_SUPERVISOR_TOKENS",
"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}]"
"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}]"
},
{
"value": "30000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
},
{
"name": "THEIA_SUPERVISOR_TOKENS",
"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}]"
"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}]"
},
{
"name": "GITPOD_INTERVAL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
},
{
"name": "THEIA_SUPERVISOR_TOKENS",
"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}]"
"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}]"
},
{
"name": "GITPOD_RESOLVED_EXTENSIONS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
},
{
"name": "THEIA_SUPERVISOR_TOKENS",
"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}]"
"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}]"
},
{
"name": "GITPOD_RESOLVED_EXTENSIONS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
},
{
"name": "THEIA_SUPERVISOR_TOKENS",
"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}]"
"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}]"
},
{
"name": "GITPOD_RESOLVED_EXTENSIONS",
Expand Down
Loading