Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/854#discussion_r43935706
--- Diff: storm-core/src/clj/backtype/storm/ui/core.clj ---
@@ -851,141 +859,151 @@
(populate-context! servlet-request)
(assert-authorized-user "getClusterInfo")
(json-response (all-topologies-summary) (:callback m)))
- (GET "/api/v1/topology/:id" [:as {:keys [cookies servlet-request
scheme]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "getTopology" (topology-config id))
- (let [user (get-user-name servlet-request)]
- (json-response (topology-page id (:window m) (check-include-sys?
(:sys m)) user (= scheme :https)) (:callback m))))
- (GET "/api/v1/topology/:id/visualization-init" [:as {:keys [cookies
servlet-request]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "getTopology" (topology-config id))
- (json-response (build-visualization id (:window m) (check-include-sys?
(:sys m))) (:callback m)))
- (GET "/api/v1/topology/:id/visualization" [:as {:keys [cookies
servlet-request]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "getTopology" (topology-config id))
- (json-response (mk-visualization-data id (:window m)
(check-include-sys? (:sys m))) (:callback m)))
- (GET "/api/v1/topology/:id/component/:component" [:as {:keys [cookies
servlet-request scheme]} id component & m]
- (populate-context! servlet-request)
- (assert-authorized-user "getTopology" (topology-config id))
- (let [user (get-user-name servlet-request)]
- (json-response
- (component-page id component (:window m) (check-include-sys?
(:sys m)) user (= scheme :https))
- (:callback m))))
- (GET "/api/v1/topology/:id/logconfig" [:as {:keys [cookies
servlet-request]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "getTopology" (topology-config id))
- (json-response (log-config id) (:callback m)))
- (POST "/api/v1/topology/:id/activate" [:as {:keys [cookies
servlet-request]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "activate" (topology-config id))
- (thrift/with-configured-nimbus-connection nimbus
- (let [tplg (->> (doto
- (GetInfoOptions.)
- (.set_num_err_choice NumErrorsChoice/NONE))
- (.getTopologyInfoWithOpts ^Nimbus$Client nimbus id))
- name (.get_name tplg)]
- (.activate nimbus name)
- (log-message "Activating topology '" name "'")))
- (json-response (topology-op-response id "activate") (m "callback")))
- (POST "/api/v1/topology/:id/deactivate" [:as {:keys [cookies
servlet-request]} id & m]
- (populate-context! servlet-request)
- (assert-authorized-user "deactivate" (topology-config id))
- (thrift/with-configured-nimbus-connection nimbus
+ (GET "/api/v1/topology/:name" [:as {:keys [cookies servlet-request
scheme]} name & m]
+ (let [id (get-id-from-name name)]
+ (populate-context! servlet-request)
--- End diff --
We have to populate the context before ever talking to nimbus.
`get-id-from-name` talks to nimbus and could potentially authenticate with the
wrong user to nimbus. This needs to be fixed everywhere.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---