NIFI-2822 - pass the JWT Authorization token i. This closes #1065

This commit is contained in:
Yolanda M. Davis 2016-09-26 12:11:28 -04:00 committed by Matt Gilman
parent 8868235993
commit 30f008d676
2 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,8 @@
<script type="text/javascript" src="../nifi/js/codemirror/addon/lint/lint.js"></script>
<script type="text/javascript" src="../nifi/js/codemirror/addon/lint/json-lint.js"></script>
<script type="text/javascript" src="../nifi/js/jsonlint/jsonlint.min.js"></script>
<script type="text/javascript" src="../nifi/js/nf/nf-namespace.js"></script>
<script type="text/javascript" src="../nifi/js/nf/nf-storage.js"></script>
<script type="text/javascript" src="../nifi/assets/angular/angular.min.js"></script>
<script type="text/javascript" src="../nifi/assets/angular-animate/angular-animate.min.js"></script>
<script type="text/javascript" src="../nifi/assets/angular-aria/angular-aria.min.js"></script>

View File

@ -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'];