Skip to content

Commit

Permalink
Troubleshooting user injection.
Browse files Browse the repository at this point in the history
Signed-off-by: AWSHurneyt <[email protected]>
  • Loading branch information
AWSHurneyt committed Jan 26, 2024
1 parent f8aeade commit 883afe6
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,7 @@ class TransportGetRemoteIndexesAction @Inject constructor(
return
}

val userStr = client.threadPool().threadContext
.getTransient<String>(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT)
log.info("hurneyt TransportGetRemoteIndexesAction::userStr = {}", userStr)

client.threadPool().threadContext.stashContext().use {
if (userStr.isNotEmpty()) client.threadPool().threadContext.putTransient(ConfigConstants.INJECTED_USER, userStr)

scope.launch {
val clusterIndexesList = mutableListOf<ClusterIndexes>()

Expand Down Expand Up @@ -170,9 +164,14 @@ class TransportGetRemoteIndexesAction @Inject constructor(
ResolveIndexAction.Request.DEFAULT_INDICES_OPTIONS
)

val userStr = client.threadPool().threadContext
.getTransient<String>(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT)
log.info("hurneyt TransportGetRemoteIndexesAction::userStr = {}", userStr)

return client.suspendUntil {
if (userStr.isNotEmpty()) threadPool().threadContext.putTransient(ConfigConstants.INJECTED_USER, userStr)
// TODO hurneyt: return aliases as well
client.admin().indices().resolveIndex(resolveRequest, it)
admin().indices().resolveIndex(resolveRequest, it)
}
}
private suspend fun getHealthStatuses(targetClient: Client, parsedIndexesNames: List<String>): ClusterHealthResponse {
Expand Down

0 comments on commit 883afe6

Please sign in to comment.