230230
231231 <template v-if =" stage === ' AUTHENTICATING' " >
232232 <div class =" auth-container-section" >
233- <div v-if =" app === 'TOOLKIT' && profileName.length > 0 " class =" header bottomMargin" >
233+ <div v-if =" selectedLoginOption === LoginOption.IAM_CREDENTIAL " class =" header bottomMargin" >
234234 Connecting to IAM...
235235 </div >
236236 <div v-else class =" header bottomMargin" >Authenticating in browser...</div >
273273 <div class =" title" >Secret Access Key</div >
274274 <input
275275 class =" iamInput bottomMargin"
276- type =" text "
276+ type =" password "
277277 id =" secretKey"
278278 name =" secretKey"
279279 v-model =" secretKey"
@@ -330,6 +330,10 @@ interface ImportedLogin {
330330 type: number
331331 startUrl: string
332332 region: string
333+ // Add IAM credential fields
334+ profileName? : string
335+ accessKey? : string
336+ secretKey? : string // Note: storing secrets has security implications
333337}
334338
335339export default defineComponent ({
@@ -349,6 +353,7 @@ export default defineComponent({
349353 data() {
350354 return {
351355 existingStartUrls: [] as string [],
356+ existingIamAccessKeys: [] as string [],
352357 importedLogins: [] as ImportedLogin [],
353358 selectedLoginOption: LoginOption .NONE ,
354359 stage: ' START' as Stage ,
@@ -368,6 +373,8 @@ export default defineComponent({
368373 const defaultSso = await this .getDefaultSso ()
369374 this .startUrl = defaultSso .startUrl
370375 this .selectedRegion = defaultSso .region
376+ const defaultIamAccessKey = await this .getDefaultIamAccessKey ()
377+ this .accessKey = defaultIamAccessKey .accessKey
371378 await this .emitUpdate (' created' )
372379 },
373380
@@ -397,6 +404,10 @@ export default defineComponent({
397404 }
398405 },
399406 handleDocumentClick(event : any ) {
407+ // Only reset selection when in START stage to avoid clearing during authentication
408+ if (this .stage !== ' START' ) {
409+ return
410+ }
400411 const isClickInsideSelectableItems = event .target .closest (' .selectable-item' )
401412 if (! isClickInsideSelectableItems ) {
402413 this .selectedLoginOption = 0
@@ -437,17 +448,32 @@ export default defineComponent({
437448 const selectedConnection =
438449 this .importedLogins [this .selectedLoginOption - LoginOption .IMPORTED_LOGINS ]
439450
440- // Imported connections cannot be Builder IDs, they are filtered out in the client.
441- const error = await client .startEnterpriseSetup (
442- selectedConnection .startUrl ,
443- selectedConnection .region ,
444- this .app
445- )
446- if (error ) {
447- this .stage = ' START'
448- void client .errorNotification (error )
449- } else {
450- this .stage = ' CONNECTED'
451+ // Handle both SSO and IAM imported connections
452+ if (selectedConnection .type === LoginOption .ENTERPRISE_SSO ) {
453+ const error = await client .startEnterpriseSetup (
454+ selectedConnection .startUrl ,
455+ selectedConnection .region ,
456+ this .app
457+ )
458+ if (error ) {
459+ this .stage = ' START'
460+ void client .errorNotification (error )
461+ } else {
462+ this .stage = ' CONNECTED'
463+ }
464+ } else if (selectedConnection .type === LoginOption .IAM_CREDENTIAL ) {
465+ // Use stored IAM credentials
466+ const error = await client .startIamCredentialSetup (
467+ selectedConnection .profileName || ' ' ,
468+ selectedConnection .accessKey || ' ' ,
469+ selectedConnection .secretKey || ' '
470+ )
471+ if (error ) {
472+ this .stage = ' START'
473+ void client .errorNotification (error )
474+ } else {
475+ this .stage = ' CONNECTED'
476+ }
451477 }
452478 } else if (this .selectedLoginOption === LoginOption .IAM_CREDENTIAL ) {
453479 this .stage = ' AWS_PROFILE'
@@ -581,6 +607,9 @@ export default defineComponent({
581607 async getDefaultSso() {
582608 return await client .getDefaultSsoProfile ()
583609 },
610+ async getDefaultIamAccessKey() {
611+ return await client .getDefaultIamKeys ()
612+ },
584613 handleHelpLinkClick() {
585614 void client .emitUiClick (' auth_helpLink' )
586615 },
0 commit comments