Skip to content

Commit a6d98d3

Browse files
committed
Add MFA code request handler
1 parent f24cbe1 commit a6d98d3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import {
3030
ResponseError,
3131
LSPErrorCodes,
3232
updateConfigurationRequestType,
33+
GetMfaCodeParams,
34+
GetMfaCodeResult,
35+
getMfaCodeRequestType,
3336
} from '@aws/language-server-runtimes/protocol'
3437
import {
3538
AuthUtil,
@@ -342,6 +345,15 @@ async function postStartLanguageServer(
342345
}
343346
)
344347

348+
// Handler for when Flare needs to assume a role with MFA code
349+
client.onRequest<GetMfaCodeParams, GetMfaCodeResult>(
350+
getMfaCodeRequestType.method,
351+
async (params: GetMfaCodeParams): Promise<GetMfaCodeResult> => {
352+
const mfaCode = await vscode.window.showInputBox({ title: 'Enter MFA Code' })
353+
return { code: mfaCode ?? '' }
354+
}
355+
)
356+
345357
const sendProfileToLsp = async () => {
346358
try {
347359
const result = await client.sendRequest(updateConfigurationRequestType.method, {

0 commit comments

Comments
 (0)