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
99import software.aws.toolkits.core.utils.error
1010import software.aws.toolkits.core.utils.getLogger
1111import software.aws.toolkits.jetbrains.core.explorer.AwsToolkitExplorerToolWindow
12- import software.aws.toolkits.jetbrains.utils.isTookitConnected
12+ import software.aws.toolkits.jetbrains.utils.isTookitConnected2
1313import javax.swing.JComponent
1414
1515class OuterToolkitPanel (val project : Project ) : BorderLayoutPanel() {
1616 private val wrapper = Wrapper ()
1717 init {
1818 isOpaque = false
1919 addToCenter(wrapper)
20- val component = if (! isTookitConnected (project) || shouldPromptToolkitReauth(project)) {
20+ val component = if (! isTookitConnected2 (project) || shouldPromptToolkitReauth(project)) {
2121 ToolkitWebviewPanel .getInstance(project).component
2222 } else {
2323 AwsToolkitExplorerToolWindow .getInstance(project)
Original file line number Diff line number Diff line change @@ -41,3 +41,31 @@ fun isTookitConnected(project: Project): Boolean =
4141
4242 return @let false
4343 }
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