This is an automated email from the ASF dual-hosted git repository. vsairam pushed a commit to branch branch-2.6 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.6 by this push: new 4afe5b5 AMBARI-24152 Ambari Workflow Manager (wfmanager) sends plaintext content over API. JSON is expected. (#1659) (#1715) (#2781) 4afe5b5 is described below commit 4afe5b518998ac54e6209027f89b508c3b18d9a5 Author: Venkata Sairam Lanka <venkatasairam.la...@gmail.com> AuthorDate: Mon Jan 28 11:28:04 2019 +0530 AMBARI-24152 Ambari Workflow Manager (wfmanager) sends plaintext content over API. JSON is expected. (#1659) (#1715) (#2781) --- .../org/apache/oozie/ambari/view/OozieProxyImpersonator.java | 12 +++++++++++- .../src/main/resources/ui/app/services/user-info.js | 5 +++-- contrib/views/wfmanager/src/main/resources/ui/package.json | 2 +- contrib/views/wfmanager/src/main/resources/ui/yarn.lock | 8 ++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java index 8d2b5a5..15a1042 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java @@ -58,6 +58,11 @@ import org.slf4j.LoggerFactory; import com.google.inject.Singleton; +import org.json.simple.JSONObject; + + + + /** * This is a class used to bridge the communication between the and the Oozie * API executing inside ambari. @@ -154,7 +159,12 @@ public class OozieProxyImpersonator { @GET @Path("/getCurrentUserName") public Response getCurrentUserName() { - return Response.ok(viewContext.getUsername()).build(); + + JSONObject obj = new JSONObject(); + + obj.put("username", viewContext.getUsername()); + + return Response.ok(obj).build(); } @GET diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/services/user-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/services/user-info.js index 701f953..3c1c5c5 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/services/user-info.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/services/user-info.js @@ -37,8 +37,9 @@ export default Ember.Service.extend({ xhr.setRequestHeader("X-Requested-By", "Ambari"); } }).done(function(data){ - self.set("userName", data); - deferred.resolve(data); + let uname = JSON.parse(data).username; + self.set("userName", JSON.parse(data).username); + deferred.resolve(uname); }).fail(function(data){ self.set("userName", ""); deferred.reject(data); diff --git a/contrib/views/wfmanager/src/main/resources/ui/package.json b/contrib/views/wfmanager/src/main/resources/ui/package.json index 25ed6c1..8405047 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/package.json +++ b/contrib/views/wfmanager/src/main/resources/ui/package.json @@ -19,7 +19,7 @@ "author": "", "license": "MIT", "devDependencies": { - "bower": "^1.7.7", + "bower": "1.8.4", "broccoli-asset-rev": "^2.2.0", "ember-ajax": "0.7.1", "ember-cli": "2.3.0", diff --git a/contrib/views/wfmanager/src/main/resources/ui/yarn.lock b/contrib/views/wfmanager/src/main/resources/ui/yarn.lock index f3602c9..e10f44b 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/yarn.lock +++ b/contrib/views/wfmanager/src/main/resources/ui/yarn.lock @@ -588,7 +588,7 @@ babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoping@^6.23.0: +babel-plugin-transform-es2015-block-scoping@^6.23.0, babel-plugin-transform-es2015-block-scoping@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz#76c295dc3a4741b1665adfd3167215dcff32a576" dependencies: @@ -989,9 +989,9 @@ bower-endpoint-parser@0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/bower-endpoint-parser/-/bower-endpoint-parser-0.2.2.tgz#00b565adbfab6f2d35addde977e97962acbcb3f6" -bower@^1.3.12, bower@^1.7.7: - version "1.8.0" - resolved "https://registry.yarnpkg.com/bower/-/bower-1.8.0.tgz#55dbebef0ad9155382d9e9d3e497c1372345b44a" +bower@1.8.4, bower@^1.3.12: + version "1.8.4" + resolved "https://registry.yarnpkg.com/bower/-/bower-1.8.4.tgz#e7876a076deb8137f7d06525dc5e8c66db82f28a" brace-expansion@^1.0.0: version "1.1.7"