Skip to content

Commit 819790f

Browse files
committed
Move MFA handler to auth2
1 parent b0e23e1 commit 819790f

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import {
3030
ResponseError,
3131
LSPErrorCodes,
3232
updateConfigurationRequestType,
33-
GetMfaCodeParams,
34-
GetMfaCodeResult,
3533
} from '@aws/language-server-runtimes/protocol'
3634
import {
3735
AuthUtil,
@@ -58,7 +56,7 @@ import { processUtils } from 'aws-core-vscode/shared'
5856
import { activate as activateChat } from './chat/activation'
5957
import { activate as activeInlineChat } from '../inlineChat/activation'
6058
import { AmazonQResourcePaths } from './lspInstaller'
61-
import { auth2, getMfaTokenFromUser, getMfaSerialFromUser } from 'aws-core-vscode/auth'
59+
import { auth2 } from 'aws-core-vscode/auth'
6260
import { ConfigSection, isValidConfigSection, pushConfigUpdate, toAmazonQLSPLogLevel } from './config'
6361
import { telemetry } from 'aws-core-vscode/telemetry'
6462
import { SessionManager } from '../app/inline/sessionManager'
@@ -339,24 +337,6 @@ async function postStartLanguageServer(
339337
}
340338
)
341339

342-
// Handler for when Flare needs to assume a role with MFA code
343-
client.onRequest(
344-
auth2.notificationTypes.getMfaCode.method,
345-
async (params: GetMfaCodeParams): Promise<GetMfaCodeResult> => {
346-
if (params.mfaSerial) {
347-
await globals.globalState.update('recentMfaSerial', { mfaSerial: params.mfaSerial })
348-
}
349-
const defaultMfaSerial = globals.globalState.tryGet('recentMfaSerial', Object, {
350-
mfaSerial: '',
351-
}).mfaSerial
352-
let mfaSerial = await getMfaSerialFromUser(defaultMfaSerial, params.profileName)
353-
mfaSerial = mfaSerial.trim()
354-
await globals.globalState.update('recentMfaSerial', { mfaSerial: mfaSerial })
355-
const mfaCode = await getMfaTokenFromUser(mfaSerial, params.profileName)
356-
return { code: mfaCode ?? '', mfaSerial: mfaSerial ?? '' }
357-
}
358-
)
359-
360340
const sendProfileToLsp = async () => {
361341
try {
362342
const result = await client.sendRequest(updateConfigurationRequestType.method, {

packages/core/src/auth/auth2.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const notificationTypes = {
7575
getConnectionMetadata: new RequestType<undefined, ConnectionMetadata, Error>(
7676
getConnectionMetadataRequestType.method
7777
),
78-
getMfaCode: new RequestType<GetMfaCodeParams, ResponseMessage, Error>(getMfaCodeRequestType.method),
7978
}
8079

8180
export type AuthState = 'notConnected' | 'connected' | 'expired'

0 commit comments

Comments
 (0)