aboutsummaryrefslogtreecommitdiff
path: root/streaming/src
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2017-02-21 16:14:34 -0800
committerMarcelo Vanzin <vanzin@cloudera.com>2017-02-21 16:14:34 -0800
commit17d83e1ee5f14e759c6e3bf0a4cba3346f00fc48 (patch)
treeacecf6d8f52c15ccf0a28fd38194ba129c9a3e05 /streaming/src
parent7363dde6348fd70d67a13bb4644baca7c77ac241 (diff)
downloadspark-17d83e1ee5f14e759c6e3bf0a4cba3346f00fc48.tar.gz
spark-17d83e1ee5f14e759c6e3bf0a4cba3346f00fc48.tar.bz2
spark-17d83e1ee5f14e759c6e3bf0a4cba3346f00fc48.zip
[SPARK-19652][UI] Do auth checks for REST API access.
The REST API has a security filter that performs auth checks based on the UI root's security manager. That works fine when the UI root is the app's UI, but not when it's the history server. In the SHS case, all users would be allowed to see all applications through the REST API, even if the UI itself wouldn't be available to them. This change adds auth checks for each app access through the API too, so that only authorized users can see the app's data. The change also modifies the existing security filter to use `HttpServletRequest.getRemoteUser()`, which is used in other places. That is not necessarily the same as the principal's name; for example, when using Hadoop's SPNEGO auth filter, the remote user strips the realm information, which then matches the user name registered as the owner of the application. I also renamed the UIRootFromServletContext trait to a more generic name since I'm using it to store more context information now. Tested manually with an authentication filter enabled. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #16978 from vanzin/SPARK-19652.
Diffstat (limited to 'streaming/src')
-rw-r--r--streaming/src/main/scala/org/apache/spark/status/api/v1/streaming/ApiStreamingApp.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/status/api/v1/streaming/ApiStreamingApp.scala b/streaming/src/main/scala/org/apache/spark/status/api/v1/streaming/ApiStreamingApp.scala
index e64830a945..aea75d5a9c 100644
--- a/streaming/src/main/scala/org/apache/spark/status/api/v1/streaming/ApiStreamingApp.scala
+++ b/streaming/src/main/scala/org/apache/spark/status/api/v1/streaming/ApiStreamingApp.scala
@@ -19,14 +19,14 @@ package org.apache.spark.status.api.v1.streaming
import javax.ws.rs.{Path, PathParam}
-import org.apache.spark.status.api.v1.UIRootFromServletContext
+import org.apache.spark.status.api.v1.ApiRequestContext
@Path("/v1")
-private[v1] class ApiStreamingApp extends UIRootFromServletContext {
+private[v1] class ApiStreamingApp extends ApiRequestContext {
@Path("applications/{appId}/streaming")
def getStreamingRoot(@PathParam("appId") appId: String): ApiStreamingRootResource = {
- uiRoot.withSparkUI(appId, None) { ui =>
+ withSparkUI(appId, None) { ui =>
new ApiStreamingRootResource(ui)
}
}
@@ -35,7 +35,7 @@ private[v1] class ApiStreamingApp extends UIRootFromServletContext {
def getStreamingRoot(
@PathParam("appId") appId: String,
@PathParam("attemptId") attemptId: String): ApiStreamingRootResource = {
- uiRoot.withSparkUI(appId, Some(attemptId)) { ui =>
+ withSparkUI(appId, Some(attemptId)) { ui =>
new ApiStreamingRootResource(ui)
}
}