File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
plugins/toolkit/jetbrains-core/src/software/aws/toolkits/jetbrains Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ import com.intellij.util.ui.components.BorderLayoutPanel
9
9
import software.aws.toolkits.core.utils.error
10
10
import software.aws.toolkits.core.utils.getLogger
11
11
import software.aws.toolkits.jetbrains.core.explorer.AwsToolkitExplorerToolWindow
12
- import software.aws.toolkits.jetbrains.utils.isTookitConnected
12
+ import software.aws.toolkits.jetbrains.utils.isTookitConnected2
13
13
import javax.swing.JComponent
14
14
15
15
class OuterToolkitPanel (val project : Project ) : BorderLayoutPanel() {
16
16
private val wrapper = Wrapper ()
17
17
init {
18
18
isOpaque = false
19
19
addToCenter(wrapper)
20
- val component = if (! isTookitConnected (project) || shouldPromptToolkitReauth(project)) {
20
+ val component = if (! isTookitConnected2 (project) || shouldPromptToolkitReauth(project)) {
21
21
ToolkitWebviewPanel .getInstance(project).component
22
22
} else {
23
23
AwsToolkitExplorerToolWindow .getInstance(project)
Original file line number Diff line number Diff line change @@ -41,3 +41,31 @@ fun isTookitConnected(project: Project): Boolean =
41
41
42
42
return @let false
43
43
}
44
+
45
+ fun isTookitConnected2 (project : Project ): Boolean =
46
+ ToolkitConnectionManager .getInstance(project).let {
47
+ if (CredentialManager .getInstance().getCredentialIdentifiers().isNotEmpty()) {
48
+ LOG .debug { " inspecting existing connection and found IAM credentials" }
49
+ return @let true
50
+ }
51
+
52
+ val conn = it.activeConnection()
53
+ val hasIdCRoleAccess = if (conn is AwsBearerTokenConnection ) {
54
+ conn.scopes.contains(IDENTITY_CENTER_ROLE_ACCESS_SCOPE )
55
+ } else {
56
+ false
57
+ }
58
+
59
+ if (hasIdCRoleAccess) {
60
+ LOG .debug { " inspecting existing connection and found bearer connections with IdCRoleAccess scope" }
61
+ return @let true
62
+ }
63
+
64
+ val isCodecatalystConn = it.activeConnectionForFeature(CodeCatalystConnection .getInstance()) != null
65
+ if (isCodecatalystConn) {
66
+ LOG .debug { " inspecting existing connection and found active Codecatalyst connection" }
67
+ return @let true
68
+ }
69
+
70
+ return @let false
71
+ }
You can’t perform that action at this time.
0 commit comments