From 30f008d6764ac9f41c9bbdeec723ed09ac5c44a6 Mon Sep 17 00:00:00 2001 From: "Yolanda M. Davis" Date: Mon, 26 Sep 2016 12:11:28 -0400 Subject: [PATCH] NIFI-2822 - pass the JWT Authorization token i. This closes #1065 --- .../src/main/webapp/WEB-INF/jsp/index.jsp | 2 ++ .../src/main/webapp/app/app.js | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp index 96eda99085..26ba321c7b 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp @@ -31,6 +31,8 @@ + + diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js index 67c440c68e..2e9cf0cbfb 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js @@ -17,7 +17,12 @@ 'use strict'; -var AppRun = function($rootScope,$state){ +var AppRun = function($rootScope,$state,$http){ + + if (nf.Storage.hasItem('jwt')) { + var token = nf.Storage.getItem('jwt'); + $http.defaults.headers.common.Authorization = 'Bearer ' + token; + } $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){ event.preventDefault(); @@ -35,7 +40,7 @@ var AppConfig = function ($urlRouterProvider) { }; -AppRun.$inject = ['$rootScope','$state']; +AppRun.$inject = ['$rootScope','$state','$http']; AppConfig.$inject = ['$urlRouterProvider'];