Skip to content

Commit 600ad26

Browse files
authored
fix(auth): login page displays connections that already exist for that service (#5186)
Problem: We do not allow the SSO form to continue if the user tries putting in an IdC start url that already exists in the same extension. However, this check isn't in place for displaying connections from the other extension. This means users can duplicate the connection start url in the extension and caused undefined behavior. Solution: Filter out existing connections from other extensions on what connections are in the current extension.
1 parent ab829fd commit 600ad26

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/core/src/login/webview/vue/login.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ export default defineComponent({
362362
363363
async mounted() {
364364
this.fetchRegions()
365-
await this.updateImportedConnections()
366365
await this.updateExistingStartUrls()
366+
await this.updateImportedConnections()
367367
368368
// Reset gathered telemetry data each time we view the login page.
369369
// The webview panel is reset on each view of the login page by design.
@@ -520,16 +520,18 @@ export default defineComponent({
520520
// or fetch existing connections of Amazon Q in AWS Toolkit
521521
// to reuse connections in AWS Toolkit & Amazon Q
522522
const sharedConnections = await client.fetchConnections()
523-
sharedConnections?.forEach((connection, index) => {
524-
this.importedLogins.push({
525-
id: LoginOption.IMPORTED_LOGINS + index,
526-
text: this.app === 'TOOLKIT' ? 'Used by Amazon Q' : 'Used by AWS Toolkit',
527-
title: `IAM Identity Center ${connection.startUrl}`,
528-
type: LoginOption.ENTERPRISE_SSO,
529-
startUrl: connection.startUrl,
530-
region: connection.ssoRegion,
523+
sharedConnections
524+
?.filter(c => !this.existingStartUrls.includes(c.startUrl))
525+
.forEach((connection, index) => {
526+
this.importedLogins.push({
527+
id: LoginOption.IMPORTED_LOGINS + index,
528+
text: this.app === 'TOOLKIT' ? 'Used by Amazon Q' : 'Used by AWS Toolkit',
529+
title: `IAM Identity Center ${connection.startUrl}`,
530+
type: LoginOption.ENTERPRISE_SSO,
531+
startUrl: connection.startUrl,
532+
region: connection.ssoRegion,
533+
})
531534
})
532-
})
533535
534536
this.$forceUpdate()
535537
},

0 commit comments

Comments
 (0)