Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 42 additions & 14 deletions packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1196,106 +1196,134 @@
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d1"
"fontCharacter": "\\f1d3"
}
},
"aws-mynah-MynahIconBlack": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d2"
"fontCharacter": "\\f1d4"
}
},
"aws-mynah-MynahIconWhite": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d3"
"fontCharacter": "\\f1d5"
}
},
"aws-mynah-logo": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d4"
"fontCharacter": "\\f1d6"
}
},
"aws-redshift-cluster": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d5"
"fontCharacter": "\\f1d7"
}
},
"aws-redshift-cluster-connected": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d6"
"fontCharacter": "\\f1d8"
}
},
"aws-redshift-database": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d7"
"fontCharacter": "\\f1d9"
}
},
"aws-redshift-redshift-cluster-connected": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d8"
"fontCharacter": "\\f1da"
}
},
"aws-redshift-schema": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d9"
"fontCharacter": "\\f1db"
}
},
"aws-redshift-table": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1da"
"fontCharacter": "\\f1dc"
}
},
"aws-s3-bucket": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1db"
"fontCharacter": "\\f1dd"
}
},
"aws-s3-create-bucket": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1dc"
"fontCharacter": "\\f1de"
}
},
"aws-schemas-registry": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1dd"
"fontCharacter": "\\f1e1"
}
},
"aws-schemas-schema": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1de"
"fontCharacter": "\\f1e2"
}
},
"aws-stepfunctions-preview": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e3"
}
},
"aws-lambda-create-stack": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d1"
}
},
"aws-lambda-create-stack-light": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d2"
}
},
"aws-sagemaker-code-editor": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1df"
}
},
"aws-sagemaker-jupyter-lab": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e0"
}
}
},
"walkthroughs": [
Expand Down
6 changes: 5 additions & 1 deletion packages/amazonq/src/lsp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export async function startLanguageServer(
},
credentials: {
providesBearerToken: true,
// Add IAM credentials support
providesIamCredentials: true,
supportsAssumeRole: true,
},
},
/**
Expand Down Expand Up @@ -211,9 +214,10 @@ export async function startLanguageServer(

/** All must be setup before {@link AuthUtil.restore} otherwise they may not trigger when expected */
AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(async () => {
const activeProfile = AuthUtil.instance.regionProfileManager.activeRegionProfile
void pushConfigUpdate(client, {
type: 'profile',
profileArn: AuthUtil.instance.regionProfileManager.activeRegionProfile?.arn,
profileArn: activeProfile?.arn,
})
})

Expand Down
63 changes: 47 additions & 16 deletions packages/amazonq/test/unit/codewhisperer/util/authUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,29 @@ import { createTestAuthUtil, TestFolder } from 'aws-core-vscode/test'
import { constants, cache } from 'aws-core-vscode/auth'
import { auth2 } from 'aws-core-vscode/auth'
import { mementoUtils, fs } from 'aws-core-vscode/shared'
import { GetIamCredentialResult } from '@aws/language-server-runtimes/protocol'

describe('AuthUtil', async function () {
let auth: any
let mockResponse: GetIamCredentialResult

beforeEach(async function () {
await createTestAuthUtil()
auth = AuthUtil.instance
mockResponse = {
credential: {
id: 'test-credential-id',
kinds: [],
credentials: {
accessKeyId: 'encrypted-access-key',
secretAccessKey: 'encrypted-secret-key',
sessionToken: 'encrypted-session-token',
},
},
updateCredentialsParams: {
data: 'credential-data',
},
} satisfies GetIamCredentialResult
})

afterEach(async function () {
Expand Down Expand Up @@ -412,36 +428,51 @@ describe('AuthUtil', async function () {

describe('loginIam', function () {
it('creates IAM session and logs in', async function () {
const mockResponse = {
id: 'test-credential-id',
credentials: {
accessKeyId: 'encrypted-access-key',
secretAccessKey: 'encrypted-secret-key',
sessionToken: 'encrypted-session-token',
},
updateCredentialsParams: {
data: 'credential-data',
},
}

const mockIamLogin = {
login: sinon.stub().resolves(mockResponse),
loginType: 'iam',
}

sinon.stub(auth2, 'IamLogin').returns(mockIamLogin as any)

const response = await auth.loginIam('accessKey', 'secretKey', 'sessionToken')
const response = await auth.loginIam({
accessKey: 'testAccessKey',
secretKey: 'testSecretKey',
sessionToken: 'testSessionToken',
})

assert.ok(mockIamLogin.login.calledOnce)
assert.ok(
mockIamLogin.login.calledWith({
accessKey: 'accessKey',
secretKey: 'secretKey',
mockIamLogin.login.calledWithMatch({
accessKey: 'testAccessKey',
secretKey: 'testSecretKey',
sessionToken: 'testSessionToken',
})
)
assert.strictEqual(response, mockResponse)
})

it('creates IAM session with role ARN', async function () {
const mockIamLoginArn = {
login: sinon.stub().resolves(mockResponse),
loginType: 'iam',
}

sinon.stub(auth2, 'IamLogin').returns(mockIamLoginArn as any)

const opts: auth2.IamProfileOptions = {
accessKey: 'testAccessKey',
secretKey: 'testSecretKey',
sessionToken: 'testSessionToken',
roleArn: 'arn:aws:iam::123456789012:role/TestRole',
}

const response = await auth.loginIam(opts)

assert.ok(mockIamLoginArn.login.calledOnce)
assert.ok(mockIamLoginArn.login.calledWith(opts))
assert.strictEqual(response, mockResponse)
})
})

describe('getIamCredential', function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@
"@aws-sdk/types": "^3.13.1",
"@aws/chat-client": "^0.1.4",
"@aws/chat-client-ui-types": "^0.1.53",
"@aws/language-server-runtimes": "^0.2.111",
"@aws/language-server-runtimes-types": "^0.1.47",
"@aws/language-server-runtimes": "^0.2.120",
"@aws/language-server-runtimes-types": "^0.1.52",
"@cspotcode/source-map-support": "^0.8.1",
"@sinonjs/fake-timers": "^10.0.2",
"@types/adm-zip": "^0.4.34",
Expand Down
Loading
Loading