Add Gateway Interceptor for passing tenant ID#4
Open
GaneshThiyagarajan wants to merge 1 commit intoaws-samples:mainfrom
Open
Add Gateway Interceptor for passing tenant ID#4GaneshThiyagarajan wants to merge 1 commit intoaws-samples:mainfrom
GaneshThiyagarajan wants to merge 1 commit intoaws-samples:mainfrom
Conversation
ujwalbukka
reviewed
Dec 12, 2025
| kb_gateway_url, | ||
| headers={ | ||
| "Authorization": f"{access_token}", | ||
| "X-Tenant-ID": tenant_id |
Contributor
There was a problem hiding this comment.
The access_token already has the tenant id, so lets not add the tenant_id in the headers.
ujwalbukka
reviewed
Dec 12, 2025
| auth_header = headers.get('authorization', '') or headers.get('Authorization', '') | ||
|
|
||
| # Extract Tenant Id from custom header for propagation | ||
| tenant_id = headers.get('X-Tenant-ID', '') |
Contributor
There was a problem hiding this comment.
Can we get this tenant id from the access token which is in the Authorization header
ujwalbukka
reviewed
Dec 12, 2025
| if "params" in extended_body and "arguments" in extended_body["params"]: | ||
| # Add custom header to arguments for downstream processing | ||
| extended_body["params"]["arguments"]["tenant_id"] = tenant_id | ||
|
|
Contributor
There was a problem hiding this comment.
We have kb-mcp-handler and log-mcp-handler tools(lambda) which uses tenant_id. So this tenant_id will be available as a part of lambda handler event?
ujwalbukka
reviewed
Dec 12, 2025
| # Add custom header to arguments for downstream processing | ||
| extended_body["params"]["arguments"]["tenant_id"] = tenant_id | ||
|
|
||
| # Return transformed request without passing the original authorization header |
Contributor
There was a problem hiding this comment.
Can you also add/move this assume role code from log-mcp-handler, to here. Then send the generated credentials as a arguments so that log-mcp-handler tool can directly use the generated credentials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.