-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
445 additions
and
410 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
components/ide/jetbrains/toolbox/src/main/kotlin/io/gitpod/toolbox/auth/GitpodAccount.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2025 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License.AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.toolbox.auth | ||
|
||
import com.jetbrains.toolbox.api.core.auth.Account | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
|
||
@Serializable | ||
class GitpodAccount : Account { | ||
private val userID: String | ||
private val name: String | ||
private val host: String | ||
private val scopes: List<String> | ||
|
||
constructor(id: String, name: String, host: String, scopes: List<String>) { | ||
this.userID = id | ||
this.name = name | ||
this.host = host | ||
this.scopes = scopes | ||
} | ||
|
||
override fun getId() = userID | ||
override fun getFullName() = name | ||
|
||
fun getGitpodHost() = host | ||
|
||
fun encode(): String { | ||
return Json.encodeToString(this) | ||
} | ||
|
||
companion object { | ||
fun decode(str: String): GitpodAccount { | ||
return Json.decodeFromString<GitpodAccount>(str) | ||
} | ||
} | ||
} | ||
|
||
class GitpodLoginConfiguration(val hostUrl: String) | ||
|
||
val authScopesJetBrainsToolbox = listOf( | ||
"function:getGitpodTokenScopes", | ||
"function:getLoggedInUser", | ||
"function:getOwnerToken", | ||
"function:getWorkspace", | ||
"function:getWorkspaces", | ||
"function:listenForWorkspaceInstanceUpdates", | ||
"function:startWorkspace", | ||
"function:stopWorkspace", | ||
"function:deleteWorkspace", | ||
"function:getToken", | ||
"resource:default", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.