Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Using common-utils for Security plugin transient thread context key
Browse files Browse the repository at this point in the history
  • Loading branch information
akbhatta committed Dec 2, 2020
1 parent 92ab019 commit c7ab12e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion reports-scheduler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
compile "${group}:common-utils:${opendistroVersion}.1"
compile "${group}:common-utils:${opendistroVersion}.2"
compileOnly "${group}:opendistro-job-scheduler-spi:${opendistroVersion}.0"
compile group: 'com.google.guava', name: 'guava', version: '15.0'
testImplementation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.amazon.opendistroforelasticsearch.reportsscheduler.action

import com.amazon.opendistroforelasticsearch.commons.ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT
import com.amazon.opendistroforelasticsearch.commons.authuser.User
import com.amazon.opendistroforelasticsearch.reportsscheduler.ReportsSchedulerPlugin.Companion.LOG_PREFIX
import com.amazon.opendistroforelasticsearch.reportsscheduler.util.logger
Expand Down Expand Up @@ -49,7 +50,6 @@ abstract class PluginBaseAction<Request : ActionRequest, Response : ActionRespon
companion object {
private val log by logger(PluginBaseAction::class.java)
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO)
private const val OPENDISTRO_SECURITY_USER_AND_ROLES = "_opendistro_security_user_and_roles"
}

/**
Expand All @@ -61,7 +61,7 @@ abstract class PluginBaseAction<Request : ActionRequest, Response : ActionRespon
request: Request,
listener: ActionListener<Response>
) {
val userStr: String? = client.threadPool().threadContext.getTransient<String>(OPENDISTRO_SECURITY_USER_AND_ROLES)
val userStr: String? = client.threadPool().threadContext.getTransient<String>(OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT)
val user: User? = User.parse(userStr)
scope.launch {
try {
Expand Down

0 comments on commit c7ab12e

Please sign in to comment.