Skip to content

Commit 74576e7

Browse files
authored
Don't allow setting up authentication for CW in Dev Env (#3974)
* Don't allow authentication for CW in Dev Env * feedback change * metrics changes * remove CW panel * added text about cw in dev env
1 parent aa64f99 commit 74576e7

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

jetbrains-core/src/software/aws/toolkits/jetbrains/core/gettingstarted/GettingStartedAuthUtils.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import software.aws.toolkits.jetbrains.core.gettingstarted.editor.getEnabledConn
3030
import software.aws.toolkits.jetbrains.core.gettingstarted.editor.getSourceOfEntry
3131
import software.aws.toolkits.resources.message
3232
import software.aws.toolkits.telemetry.AuthTelemetry
33-
import software.aws.toolkits.telemetry.CredentialSourceId
3433
import software.aws.toolkits.telemetry.FeatureId
3534
import software.aws.toolkits.telemetry.Result
3635
import java.io.IOException
@@ -128,7 +127,7 @@ fun requestCredentialsForCodeWhisperer(
128127
project,
129128
source = getSourceOfEntry(SourceOfEntry.CODEWHISPERER, isFirstInstance, connectionInitiatedFromExplorer),
130129
featureId = FeatureId.Codewhisperer,
131-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
130+
credentialSourceId = authenticationDialog.authType,
132131
isAggregated = true,
133132
attempts = authenticationDialog.attempts + 1,
134133
result = Result.Succeeded
@@ -148,7 +147,7 @@ fun requestCredentialsForCodeWhisperer(
148147
project,
149148
source = getSourceOfEntry(SourceOfEntry.CODEWHISPERER, isFirstInstance, connectionInitiatedFromExplorer),
150149
featureId = FeatureId.Codewhisperer,
151-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
150+
credentialSourceId = authenticationDialog.authType,
152151
isAggregated = false,
153152
attempts = authenticationDialog.attempts + 1,
154153
result = Result.Cancelled,
@@ -190,7 +189,7 @@ fun requestCredentialsForExplorer(
190189
project,
191190
source = getSourceOfEntry(SourceOfEntry.RESOURCE_EXPLORER, isFirstInstance, connectionInitiatedFromExplorer),
192191
featureId = FeatureId.AwsExplorer,
193-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
192+
credentialSourceId = authenticationDialog.authType,
194193
isAggregated = true,
195194
attempts = authenticationDialog.attempts + 1,
196195
result = Result.Succeeded
@@ -210,7 +209,7 @@ fun requestCredentialsForExplorer(
210209
project,
211210
source = getSourceOfEntry(SourceOfEntry.RESOURCE_EXPLORER, isFirstInstance, connectionInitiatedFromExplorer),
212211
featureId = FeatureId.AwsExplorer,
213-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
212+
credentialSourceId = authenticationDialog.authType,
214213
isAggregated = false,
215214
attempts = authenticationDialog.attempts + 1,
216215
result = Result.Cancelled,

jetbrains-core/src/software/aws/toolkits/jetbrains/core/gettingstarted/SetupAuthenticationDialog.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class SetupAuthenticationDialog(
146146
private val iamTab = iamTab()
147147
private val wrappers = SetupAuthenticationTabs.values().associateWith { BorderLayoutPanel() }
148148
var attempts = 0
149+
var authType = CredentialSourceId.IamIdentityCenter
149150

150151
init {
151152
title = message("gettingstarted.setup.title")
@@ -264,6 +265,7 @@ class SetupAuthenticationDialog(
264265

265266
when (selectedTab()) {
266267
SetupAuthenticationTabs.IDENTITY_CENTER -> {
268+
authType = CredentialSourceId.IamIdentityCenter
267269
val profileName = state.idcTabState.profileName
268270
if (configFilesFacade.readSsoSessions().containsKey(profileName)) {
269271
Messages.showErrorDialog(project, message("gettingstarted.setup.iam.session.exists", profileName), title)
@@ -326,18 +328,20 @@ class SetupAuthenticationDialog(
326328
}
327329

328330
SetupAuthenticationTabs.BUILDER_ID -> {
331+
authType = CredentialSourceId.AwsId
329332
loginSso(project, SONO_URL, SONO_REGION, scopes)
330333
}
331334

332335
SetupAuthenticationTabs.IAM_LONG_LIVED -> {
336+
authType = CredentialSourceId.SharedCredentials
333337
val profileName = state.iamTabState.profileName
334338
if (configFilesFacade.readAllProfiles().containsKey(profileName)) {
335339
Messages.showErrorDialog(project, message("gettingstarted.setup.iam.profile.exists", profileName), title)
336340
AuthTelemetry.addConnection(
337341
project,
338342
source = getSourceOfEntry(sourceOfEntry, isFirstInstance, connectionInitiatedFromExplorer),
339343
featureId = featureId,
340-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
344+
credentialSourceId = CredentialSourceId.SharedCredentials,
341345
isAggregated = false,
342346
attempts = attempts + 1,
343347
result = Result.Failed,
@@ -364,7 +368,7 @@ class SetupAuthenticationDialog(
364368
project,
365369
source = getSourceOfEntry(sourceOfEntry, isFirstInstance, connectionInitiatedFromExplorer),
366370
featureId = featureId,
367-
credentialSourceId = CredentialSourceId.IamIdentityCenter,
371+
credentialSourceId = CredentialSourceId.SharedCredentials,
368372
isAggregated = false,
369373
attempts = attempts + 1,
370374
result = Result.Failed,

jetbrains-core/src/software/aws/toolkits/jetbrains/core/gettingstarted/editor/GettingStartedPanel.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import software.aws.toolkits.jetbrains.services.caws.CawsResources
7272
import software.aws.toolkits.jetbrains.services.codewhisperer.learn.LearnCodeWhispererEditorProvider
7373
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.CODEWHISPERER_LEARN_MORE_URI
7474
import software.aws.toolkits.jetbrains.ui.feedback.FeedbackDialog
75+
import software.aws.toolkits.jetbrains.utils.isRunningOnRemoteBackend
7576
import software.aws.toolkits.jetbrains.utils.ui.editorNotificationCompoundBorder
7677
import software.aws.toolkits.resources.message
7778
import software.aws.toolkits.telemetry.AuthTelemetry
@@ -174,7 +175,12 @@ class GettingStartedPanel(
174175
setTitleFont(JBFont.h1().asBold())
175176
}.align(AlignX.FILL)
176177
}
178+
row {
179+
label("Note: " + (message("gettingstarted.codewhisperer.remote"))).applyToComponent {
177180

181+
font = JBFont.h4().asBold()
182+
}
183+
}.bottomGap(BottomGap.SMALL).visible(isRunningOnRemoteBackend())
178184
featureSetPanel.setFeatureContent()
179185
row {
180186
cell(featureSetPanel)
@@ -209,7 +215,7 @@ class GettingStartedPanel(
209215
)
210216
)
211217
)
212-
)
218+
).visible(!isRunningOnRemoteBackend())
213219
// Resource Explorer panel auth bullets
214220
cell(
215221
PanelAuthBullets(
@@ -1152,7 +1158,7 @@ class GettingStartedPanel(
11521158
panel {
11531159
row {
11541160
// CodeWhisperer panel
1155-
cell(CodeWhispererPanel())
1161+
cell(CodeWhispererPanel()).visible(!isRunningOnRemoteBackend())
11561162
// Resource Explorer Panel
11571163
cell(ResourceExplorerPanel())
11581164
// CodeCatalyst Panel

resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ gettingstarted.builderid.description=Personal profile for builders
964964
gettingstarted.codecatalyst.open.explorer=Open CodeCatalyst menu
965965
gettingstarted.codecatalyst.panel.create.space=Create a CodeCatalyst space
966966
gettingstarted.codecatalyst.panel.setup=Set up CodeCatalyst
967+
gettingstarted.codewhisperer.remote=CodeWhisperer is unavailable in JetBrains Gateway
967968
gettingstarted.connecting.in.browser=Connecting in browser...
968969
gettingstarted.editor.title=Authenticate with AWS Toolkit
969970
gettingstarted.explorer.gotit.codecatalyst.body=Launch Dev Environments and find more features here.

0 commit comments

Comments
 (0)