AWS amazonq medium security documentation change
Summary
Updated authentication parameters and added configuration options for identity propagation plugins
Security assessment
The changes modify authentication mechanisms by replacing direct token handling with a webTokenProvider function, introducing IAM role ARNs for identity context propagation, and adding explicit OIDC/STS client configuration options. These updates improve security by enforcing proper identity federation patterns and providing clearer guidance on secure credential handling. The addition of applicationRoleArn and client configuration parameters helps implement least-privilege access.
Diff
diff --git a/amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.md b/amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.md index fabf231f9..59ef16a94 100644 --- a//amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.md +++ b//amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.md @@ -282 +282 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - * `idToken` – The token ID (JWT token). + * `webTokenProvider` – A function that the customer implements to obtain an OpenID token from their external identity provider. @@ -284 +284 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - * `ssoClientId` – The Amazon Resource Name (ARN) of the custom IAM Identity Center application you created in Step 3 of [one-time setup](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.html#control-plane-setup). + * `accessRoleArn` – The IAM role ARN to be assumed by the plugin with the user's identity context to get the identity-enhanced credentials. @@ -286 +286 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - * `roleArn` – The Amazon Resource Name (ARN) of the IAM role you created in Step 8 of [one-time setup](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/making-sigv4-authenticated-api-calls.html#control-plane-setup). + * `applicationArn` – The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured. @@ -287,0 +288 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B + * `applicationRoleArn` – The IAM role ARN to be assumed with `AssumeRoleWithWebIdentity` so that the OIDC and AWS STS clients can be bootstrapped. If `applicationRoleArn` is not provided, it is mandatory to provide both `ssoOidcClient` and `stsClient` parameters. @@ -288,0 +290 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B + * `ssoOidcClient` – An IAM Identity Center OIDC client, such as `SsoOidcClient` for Java or `client-sso-oidc` for Javascript, with customer-defined configurations. If not provided, an OIDC client using `applicationRoleArn` will be instantiated and used. @@ -289,0 +292 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B + * `stsClient` – An AWS STS client with customer-defined configurations, used to assume `accessRoleArn` with the user's identity context. If not provided, an AWS STS client using `applicationRoleArn` will be instantiated and used. @@ -292,4 +295,33 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - TrustedIdentityPropagationPlugin tipPlugin = TrustedIdentityPropagationPlugin.builder() - .webTokenProvider(() -> id token from Okta) - .applicationArn(your custom IdC application arn) - .accessRoleArn(AccessRoleArn)) + + +If both `ssoOidcClient` and `stsClient`, and `applicationRoleArn` are provided, the former is prioritized. + + + // Option-1: Build and pass OIDC and STS clients + SsoOidcClient oidcClient = SsoOidcClient.builder() + .region(Region.US_EAST_1) + .credentialsProvider(credentialsProvider).build(); + + StsClient stsClient = StsClient.builder() + .region(Region.US_EAST_1) + .credentialsProvider(credentialsProvider).build(); + + TrustedIdentityPropagationPlugin trustedIdentityPropagationPlugin = TrustedIdentityPropagationPlugin.builder() + .webTokenProvider(() -> webToken) + .applicationArn(idcApplicationArn) + .accessRoleArn(accessRoleArn) + .ssoOidcClient(client) + .stsClient(stsClient) + .build(); + + // Option-2: Pass applicationRoleArn and defer the STS & OIDC clients creation to the plugin + TrustedIdentityPropagationPlugin trustedIdentityPropagationPlugin = TrustedIdentityPropagationPlugin.builder() + .webTokenProvider(() -> webToken) + .applicationArn(idcApplicationArn) + .accessRoleArn(accessRoleArn) + .applicationRoleArn(applicationRoleArn) + .build(); + + QBusinessClient qBusinessClient = QBusinessClient.builder() + .region(Region.US_EAST_1) + .addPlugin(trustedIdentityPropagationPlugin) @@ -298,2 +330,5 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - QBusinessClient qbiz = QBusinessClient.builder() - .addPlugin(tipPlugin) + // Create ChatSyncRequest + ChatSyncRequest chatSyncRequest = ChatSyncRequest.builder() + .applicationId(applicationId) + .userMessage(userMessage) + // You can add conversationId, attachments, chatMode, etc. here @@ -302 +337,2 @@ Use the Java or JavaScript SDK to create the plugin and make calls to Amazon Q B - qbiz.chatSync(...) + // Call chatSync operation + ChatSyncResponse chatSyncResponse = qBusinessClient.chatSync(chatSyncRequest);