nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbe...@apache.org
Subject [2/4] nifi-registry git commit: NIFIREG-30 - GET users/groups, delete user/group, delete users/groups, create group, introduce group side nav - Add selected users to selected groups - Update JS unit tests - Add kerberos support
Date Tue, 28 Nov 2017 19:34:44 GMT
http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/247985ad/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js
----------------------------------------------------------------------
diff --git a/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js
index 00e22e1..253aef2 100644
--- a/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js
+++ b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js
@@ -15,25 +15,35 @@
  * limitations under the License.
  */
 
-var ngHttp = require('@angular/http');
+var NfStorage = require('nifi-registry/services/nf-storage.service.js');
+var ngCommonHttp = require('@angular/common/http');
 var fdsDialogsModule = require('@fluid-design-system/dialogs');
 var rxjs = require('rxjs/Rx');
 var ngRouter = require('@angular/router');
-
+var MILLIS_PER_SECOND = 1000;
 var headers = new Headers({'Content-Type': 'application/json'});
 
+var config = {
+    urls: {
+        currentUser: '/nifi-registry-api/access',
+        kerberos: '/nifi-registry-api/access/token/kerberos'
+    }
+};
+
 /**
  * NfRegistryApi constructor.
  *
- * @param Http                  The angular http module.
- * @param FdsDialogService      The FDS dialog service.
- * @param Router                The angular router module.
+ * @param nfStorage             A wrapper for the browser's local storage.
+ * @param http                  The angular http module.
+ * @param fdsDialogService      The FDS dialog service.
+ * @param router                The angular router module.
  * @constructor
  */
-function NfRegistryApi(Http, FdsDialogService, Router) {
-    this.http = Http;
-    this.dialogService = FdsDialogService;
-    this.router = Router;
+function NfRegistryApi(nfStorage, http, fdsDialogService, router) {
+    this.nfStorage = nfStorage;
+    this.http = http;
+    this.dialogService = fdsDialogService;
+    this.router = router;
 };
 
 NfRegistryApi.prototype = {
@@ -51,16 +61,16 @@ NfRegistryApi.prototype = {
         url += '/versions';
         return this.http.get(url)
             .map(function (response) {
-                return response.json() || [];
+                return response || [];
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -77,12 +87,12 @@ NfRegistryApi.prototype = {
         var url = '/nifi-registry-api/buckets/' + bucketId + '/' + dropletType + '/' + dropletId;
         return this.http.get(url)
             .map(function (response) {
-                return response.json() || {};
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 }).afterClosed().subscribe(
@@ -91,7 +101,7 @@ NfRegistryApi.prototype = {
                             self.router.navigateByUrl('/nifi-registry/explorer/grid-list/buckets/' + bucketId);
                         }
                     });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -112,16 +122,16 @@ NfRegistryApi.prototype = {
         }
         return this.http.get(url)
             .map(function (response) {
-                return response.json() || [];
+                return response || [];
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -140,17 +150,16 @@ NfRegistryApi.prototype = {
         var self = this;
         return this.http.delete('/nifi-registry-api/' + dropletUri, headers)
             .map(function (response) {
-                var body = response.json();
-                return response.json() || {};
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -164,17 +173,16 @@ NfRegistryApi.prototype = {
         var self = this;
         return this.http.post('/nifi-registry-api/buckets', {'name': name}, headers)
             .map(function (response) {
-                var body = response.json();
-                return response.json() || {};
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -188,17 +196,16 @@ NfRegistryApi.prototype = {
         var self = this;
         return this.http.delete('/nifi-registry-api/buckets/' + bucketId, headers)
             .map(function (response) {
-                var body = response.json();
-                return response.json() || {};
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -213,12 +220,12 @@ NfRegistryApi.prototype = {
         var url = '/nifi-registry-api/buckets/' + bucketId;
         return this.http.get(url)
             .map(function (response) {
-                return response.json() || {};
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 }).afterClosed().subscribe(
@@ -227,7 +234,7 @@ NfRegistryApi.prototype = {
                             self.router.navigateByUrl('/nifi-registry/explorer/grid-list');
                         }
                     });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -244,17 +251,16 @@ NfRegistryApi.prototype = {
         var url = '/nifi-registry-api/buckets';
         return this.http.get(url)
             .map(function (response) {
-                var body = response.json();
-                return response.json() || [];
+                return response || [];
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
@@ -263,161 +269,268 @@ NfRegistryApi.prototype = {
         var self = this;
         return this.http.get('/nifi-registry-api/users/' + userId)
             .map(function (response) {
-                return response.json() || {};
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Creates a user.
+     *
+     * @param {string} identifier   The identifier of the user.
+     * @param {string} identity     The identity of the user.
+     * @returns {*}
+     */
+    addUser: function (identifier, identity) {
+        var self = this;
+        return this.http.post('/nifi-registry-api/tenants/users', {
+            'identifier': identifier,
+            'identity': identity
+        }, headers)
+            .map(function (response) {
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Gets all users.
+     *
+     * @returns {*}
+     */
+    getUsers: function () {
+        var self = this;
+        return this.http.get('nifi-registry-api/tenants/users')
+            .map(function (response) {
+                return response || [];
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Delete an existing user from the registry.
+     *
+     * @param {string} userId     The identifier of the user to be deleted.
+     * @returns {*}
+     */
+    deleteUser: function (userId) {
+        var self = this;
+        return this.http.delete('/nifi-registry-api/tenants/users/' + userId, headers)
+            .map(function (response) {
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Gets all user groups.
+     *
+     * @returns {*}
+     */
+    getUserGroups: function () {
+        var self = this;
+        return this.http.get('nifi-registry-api/tenants/user-groups')
+            .map(function (response) {
+                return response || [];
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Get user group.
+     *
+     * @param {string} groupId  The id of the group to retrieve.
+     * @returns {*}
+     */
+    getUserGroup: function (groupId) {
+        var self = this;
+        return this.http.get('/nifi-registry-api/tenants/user-groups/' + groupId)
+            .map(function (response) {
+                return response || {};
             })
             .catch(function (error) {
                 self.dialogService.openConfirm({
                     title: 'Error',
-                    message: error._body,
+                    message: error.message,
                     acceptButton: 'Ok',
                     acceptButtonColor: 'fds-warn'
                 });
-                return rxjs.Observable.throw(error._body);
+                return rxjs.Observable.throw(error.message);
             });
     },
 
-    //TODO: REST call to API to get users.
-    getUsers: function (userIds, bucketId) {
+    /**
+     * Delete an existing user group from the registry.
+     *
+     * @param {string} userGroupId     The identifier of the user group to be deleted.
+     * @returns {*}
+     */
+    deleteUserGroup: function (userGroupId) {
         var self = this;
-        return new Promise(
-            function (resolve) {
-                resolve([{
-                    id: '23f6cc59-0156-1000-06b4-2b0810089090',
-                    name: 'Scotty 2 Hotty',
-                    status: 'authorized',
-                    provider: 'Friendly LDAP Provider',
-                    type: 'user',
-                    activities: [{
-                        id: '25fd6vv87-3249-0001-05g6-4d4767890765',
-                        description: 'Saved something...',
-                        created: new Date().setDate(new Date().getDate() - 1),
-                        updated: new Date()
-                    }],
-                    actions: [{
-                        'name': 'details',
-                        'icon': 'fa fa-info-circle',
-                        'tooltip': 'User Details',
-                        'type': 'sidenav',
+        return this.http.delete('/nifi-registry-api/tenants/user-groups/' + userGroupId, headers)
+            .map(function (response) {
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
+
+    /**
+     * Creates a new group.
+     *
+     * @param {string} identifier   The identifier of the user.
+     * @param {string} identity     The identity of the user.
+     * @param {array} users         The array of users to be added to the new group.
+     * @returns {*}
+     */
+    createNewGroup: function (identifier, identity, users) {
+        var self = this;
+        return this.http.post('/nifi-registry-api/tenants/user-groups', {
+            'identifier': identifier,
+            'identity': identity,
+            'users': users
+        }, headers)
+            .map(function (response) {
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
+            });
+    },
 
-                    }, {
-                        'name': 'permissions',
-                        'icon': 'fa fa-key',
-                        'tooltip': 'Manage User Policies',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'Delete',
-                        'icon': 'fa fa-trash',
-                        'tooltip': 'Delete User'
-                    }, {
-                        'name': 'Suspend',
-                        'icon': 'fa fa-ban',
-                        'tooltip': 'Suspend User'
-                    }]
-                }, {
-                    id: '25fd6vv87-3249-0001-05g6-4d4767890765',
-                    name: 'Group 1',
-                    status: 'suspended',
-                    provider: 'IOAT',
-                    type: 'group',
-                    actions: [{
-                        'name': 'details',
-                        'icon': 'fa fa-info-circle',
-                        'tooltip': 'User Details',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'permissions',
-                        'icon': 'fa fa-key',
-                        'tooltip': 'Manage User Policies',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'Delete',
-                        'icon': 'fa fa-trash',
-                        'tooltip': 'Delete User'
-                    }, {
-                        'name': 'Reauthorize',
-                        'icon': 'fa fa-check-circle',
-                        'tooltip': 'Reauthorize User'
-                    }]
-                }, {
-                    id: '98f6cc59-0156-1000-06b4-2b0810089090',
-                    name: 'G$',
-                    status: 'authorized',
-                    provider: 'Friendly LDAP Provider',
-                    type: 'user',
-                    actions: [{
-                        'name': 'details',
-                        'icon': 'fa fa-info-circle',
-                        'tooltip': 'User Details',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'permissions',
-                        'icon': 'fa fa-key',
-                        'tooltip': 'Manage User Policies',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'Delete',
-                        'icon': 'fa fa-trash',
-                        'tooltip': 'Delete User'
-                    }, {
-                        'name': 'Suspend',
-                        'icon': 'fa fa-ban',
-                        'tooltip': 'Suspend User'
-                    }]
-                }, {
-                    id: '65fd6vv87-3249-0001-05g6-4d4767890765',
-                    name: 'Group 2',
-                    status: 'suspended',
-                    provider: 'IOAT',
-                    type: 'group',
-                    actions: [{
-                        'name': 'details',
-                        'icon': 'fa fa-info-circle',
-                        'tooltip': 'User Details',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'permissions',
-                        'icon': 'fa fa-key',
-                        'tooltip': 'Manage User Policies',
-                        'type': 'sidenav'
-                    }, {
-                        'name': 'Delete',
-                        'icon': 'fa fa-trash',
-                        'tooltip': 'Delete User'
-                    }, {
-                        'name': 'Reauthorize',
-                        'icon': 'fa fa-check-circle',
-                        'tooltip': 'Reauthorize User'
-                    }]
-                }]);
+    /**
+     * Updates a group.
+     *
+     * @param {string} identifier   The identifier of the group.
+     * @param {string} identity     The identity of the group.
+     * @param {array} users         The array of users in the new group.
+     * @returns {*}
+     */
+    updateUserGroup: function (identifier, identity, users) {
+        var self = this;
+        return this.http.put('/nifi-registry-api/tenants/user-groups/' + identifier, {
+            'identifier': identifier,
+            'identity': identity,
+            'users': users
+        }, headers)
+            .map(function (response) {
+                return response || {};
+            })
+            .catch(function (error) {
+                self.dialogService.openConfirm({
+                    title: 'Error',
+                    message: error.message,
+                    acceptButton: 'Ok',
+                    acceptButtonColor: 'fds-warn'
+                });
+                return rxjs.Observable.throw(error.message);
             });
-        // return this.http.get('/nifi-registry-api/users/?bucket=' + bucketId)
-        //     .map(function (response) {
-        //         return response.json() || [];
-        //     })
-        //     .catch(function (error) {
-        //     self.dialogService.openConfirm({
-        //         title: 'Error',
-        //         message: error._body,
-        //         acceptButton: 'Ok',
-        //         acceptButtonColor: 'fds-warn'
-        //     });
-        //     return rxjs.Observable.throw(error._body);
-        // });
     },
 
-    //TODO: REST call to API to delete user by id.
-    deleteUser: function (id) {
+    /**
+     * Kerberos ticket exchange.
+     *
+     * @returns {*}
+     */
+    ticketExchange: function () {
         var self = this;
+        if (this.nfStorage.hasItem('jwt')) {
+            return rxjs.Observable.of(self.nfStorage.getItem('jwt'));
+        } else {
+            return this.http.post(config.urls.kerberos, null, {responseType: 'text'})
+                .map(function (jwt) {
+                    // get the payload and store the token with the appropriate expiration
+                    var token = self.nfStorage.getJwtPayload(jwt);
+                    if(token) {
+                        var expiration = parseInt(token['exp'], 10) * MILLIS_PER_SECOND;
+                        self.nfStorage.setItem('jwt', jwt, expiration);
+                    }
+                    return jwt;
+                })
+                .catch(function (error) {
+                    return rxjs.Observable.of('');
+                });
+        }
     },
 
-    //TODO: REST call to API to suspend user by id.
-    suspendUser: function (id) {
+    /**
+     * Loads the current user and updates the current user locally.
+     *
+     * @returns xhr
+     */
+    loadCurrentUser: function () {
         var self = this;
+        // get the current user
+        return this.http.get(config.urls.currentUser)
+            .map(function (response) {
+                return response;
+            })
+            .catch(function (error) {
+                // there is no anonymous access and we don't know this user - open the login page which handles login/registration/etc
+                if (error.status === 401) {
+                    self.router.navigateByUrl('/nifi-registry/login');
+                }
+                return rxjs.Observable.of({});
+            });
     }
 };
 
 NfRegistryApi.parameters = [
-    ngHttp.Http,
+    NfStorage,
+    ngCommonHttp.HttpClient,
     fdsDialogsModule.FdsDialogService,
     ngRouter.Router
 ];

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/247985ad/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.spec.js
----------------------------------------------------------------------
diff --git a/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.spec.js b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.spec.js
index ee03398..da57d29 100644
--- a/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.spec.js
+++ b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.spec.js
@@ -17,7 +17,7 @@
 
 var NfRegistryRoutes = require('nifi-registry/nf-registry.routes.js');
 var ngCoreTesting = require('@angular/core/testing');
-var ngHttpTesting = require('@angular/http/testing');
+var ngCommonHttpTesting = require('@angular/common/http/testing');
 var ngCommon = require('@angular/common');
 var FdsDemo = require('nifi-registry/components/fluid-design-system/fds-demo.js');
 var NfRegistry = require('nifi-registry/nf-registry.js');
@@ -27,9 +27,10 @@ var NfPageNotFoundComponent = require('nifi-registry/components/page-not-found/n
 var NfRegistryExplorer = require('nifi-registry/components/explorer/nf-registry-explorer.js');
 var NfRegistryAdministration = require('nifi-registry/components/administration/nf-registry-administration.js');
 var NfRegistryUsersAdministration = require('nifi-registry/components/administration/users/nf-registry-users-administration.js');
-var NfRegistryAddUser = require('nifi-registry/components/administration/users/add/nf-registry-add-user.js');
+var NfRegistryAddUser = require('nifi-registry/components/administration/users/dialogs/add-user/nf-registry-add-user.js');
 var NfRegistryUserDetails = require('nifi-registry/components/administration/users/details/nf-registry-user-details.js');
 var NfRegistryUserPermissions = require('nifi-registry/components/administration/users/permissions/nf-registry-user-permissions.js');
+var NfRegistryUserGroupPermissions = require('nifi-registry/components/administration/user-group/permissions/nf-registry-user-group-permissions.js');
 var NfRegistryBucketPermissions = require('nifi-registry/components/administration/workflow/buckets/permissions/nf-registry-bucket-permissions.js');
 var NfRegistryWorkflowAdministration = require('nifi-registry/components/administration/workflow/nf-registry-workflow-administration.js');
 var NfRegistryGridListViewer = require('nifi-registry/components/explorer/grid-list/registry/nf-registry-grid-list-viewer.js');
@@ -38,10 +39,16 @@ var NfRegistryDropletGridListViewer = require('nifi-registry/components/explorer
 var fdsCore = require('@fluid-design-system/core');
 var ngMoment = require('angular2-moment');
 var ngHttp = require('@angular/http');
+var rxjs = require('rxjs/Rx');
+var ngCommonHttp = require('@angular/common/http');
+var NfRegistryTokenInterceptor = require('nifi-registry/services/nf-registry.token.interceptor.js');
+var NfRegistryAuthService = require('nifi-registry/services/nf-registry.auth.service.js');
+var NfStorage = require('nifi-registry/services/nf-storage.service.js');
 
 describe('NfRegistry Service API w/ Angular testing utils', function () {
     var comp;
     var fixture;
+    var nfRegistryApi;
     var nfRegistryService;
 
     beforeEach(function () {
@@ -50,8 +57,10 @@ describe('NfRegistry Service API w/ Angular testing utils', function () {
                 ngMoment.MomentModule,
                 ngHttp.HttpModule,
                 ngHttp.JsonpModule,
+                ngCommonHttp.HttpClientModule,
                 fdsCore,
-                NfRegistryRoutes
+                NfRegistryRoutes,
+                ngCommonHttpTesting.HttpClientTestingModule
             ],
             declarations: [
                 FdsDemo,
@@ -61,6 +70,7 @@ describe('NfRegistry Service API w/ Angular testing utils', function () {
                 NfRegistryUsersAdministration,
                 NfRegistryUserDetails,
                 NfRegistryUserPermissions,
+                NfRegistryUserGroupPermissions,
                 NfRegistryBucketPermissions,
                 NfRegistryAddUser,
                 NfRegistryWorkflowAdministration,
@@ -71,150 +81,135 @@ describe('NfRegistry Service API w/ Angular testing utils', function () {
             ],
             providers: [
                 NfRegistryService,
+                NfRegistryAuthService,
                 NfRegistryApi,
+                NfStorage,
                 {
-                    provide: ngCommon.APP_BASE_HREF,
-                    useValue: '/'
+                    provide: ngCommonHttp.HTTP_INTERCEPTORS,
+                    useClass: NfRegistryTokenInterceptor,
+                    multi: true
                 },
                 {
-                    provide: ngHttp.XHRBackend,
-                    useClass: ngHttpTesting.MockBackend
+                    provide: ngCommon.APP_BASE_HREF,
+                    useValue: '/'
                 }
             ],
             bootstrap: [NfRegistry]
         });
-    });
-
-    it('should GET droplet snapshot metadata.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
         fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
         fixture.detectChanges();
         comp = fixture.componentInstance;
 
         // NfRegistryService from the root injector
         nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
+        nfRegistryApi = ngCoreTesting.TestBed.get(NfRegistryApi);
+        spyOn(nfRegistryApi, 'ticketExchange').and.callFake(function () {}).and.returnValue(rxjs.Observable.of({}));
+        spyOn(nfRegistryService, 'loadCurrentUser').and.callFake(function () {}).and.returnValue(rxjs.Observable.of({}));
+    });
 
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {
-            snapshotMetadata: [
-                {bucketIdentifier: '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc', version: 999}
-            ]
-        };
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should GET droplet snapshot metadata.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.getDropletSnapshotMetadata('flow/test').subscribe(function (response) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/flow/test/versions');
+        nfRegistryApi.getDropletSnapshotMetadata('flow/test').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/flow/test/versions');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({
+                snapshotMetadata: [
+                    {bucketIdentifier: '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc', version: 999}
+                ]
+            });
+            httpMock.verify();
         });
     }));
 
-    it('should GET droplet by type and ID.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {
-            'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
-            'name': 'Flow #1',
-            'description': 'This is flow #1',
-            'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'createdTimestamp': 1505931890999,
-            'modifiedTimestamp': 1505931890999,
-            'type': 'FLOW',
-            'snapshotMetadata': null,
-            'link': {
-                'params': {
-                    'rel': 'self'
-                },
-                'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
-            }
-        };
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should GET droplet by type and ID.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.getDroplet('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc', 'flows', '2e04b4fb-9513-47bb-aa74-1ae34616bfdc').subscribe(function (droplet) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/buckets/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc/flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc');
+        nfRegistryApi.getDroplet('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc', 'flows', '2e04b4fb-9513-47bb-aa74-1ae34616bfdc').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/buckets/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc/flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({
+                'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
+                'name': 'Flow #1',
+                'description': 'This is flow #1',
+                'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'createdTimestamp': 1505931890999,
+                'modifiedTimestamp': 1505931890999,
+                'type': 'FLOW',
+                'snapshotMetadata': null,
+                'link': {
+                    'params': {
+                        'rel': 'self'
+                    },
+                    'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
+                }
+            });
+            httpMock.verify();
             expect(droplet.identifier).toEqual('2e04b4fb-9513-47bb-aa74-1ae34616bfdc');
             expect(droplet.type).toEqual('FLOW');
             expect(droplet.name).toEqual('Flow #1');
         });
     }));
 
-    it('should GET all droplets across all buckets.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = [{
-            'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
-            'name': 'Flow #1',
-            'description': 'This is flow #1',
-            'bucketIdentifier': '9q7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'createdTimestamp': 1505931890999,
-            'modifiedTimestamp': 1505931890999,
-            'type': 'FLOW',
-            'snapshotMetadata': null,
-            'link': {
-                'params': {
-                    'rel': 'self'
-                },
-                'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
-            }
-        }, {
-            'identifier': '5d04b4fb-9513-47bb-aa74-1ae34616bfdc',
-            'name': 'Flow #2',
-            'description': 'This is flow #2',
-            'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'createdTimestamp': 1505931890999,
-            'modifiedTimestamp': 1505931890999,
-            'type': 'FLOW',
-            'snapshotMetadata': null,
-            'link': {
-                'params': {
-                    'rel': 'self'
-                },
-                'href': 'flows/5d04b4fb-9513-47bb-aa74-1ae34616bfdc'
-            }
-        }];
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should GET all droplets across all buckets.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.getDroplets().subscribe(function (droplets) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/items');
+        nfRegistryApi.getDroplets().subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/items');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush([{
+                'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
+                'name': 'Flow #1',
+                'description': 'This is flow #1',
+                'bucketIdentifier': '9q7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'createdTimestamp': 1505931890999,
+                'modifiedTimestamp': 1505931890999,
+                'type': 'FLOW',
+                'snapshotMetadata': null,
+                'link': {
+                    'params': {
+                        'rel': 'self'
+                    },
+                    'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
+                }
+            }, {
+                'identifier': '5d04b4fb-9513-47bb-aa74-1ae34616bfdc',
+                'name': 'Flow #2',
+                'description': 'This is flow #2',
+                'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'createdTimestamp': 1505931890999,
+                'modifiedTimestamp': 1505931890999,
+                'type': 'FLOW',
+                'snapshotMetadata': null,
+                'link': {
+                    'params': {
+                        'rel': 'self'
+                    },
+                    'href': 'flows/5d04b4fb-9513-47bb-aa74-1ae34616bfdc'
+                }
+            }]);
+            httpMock.verify();
             expect(droplets.length).toBe(2);
             expect(droplets[0].bucketIdentifier).toEqual('9q7f9e54-dc09-4ceb-aa58-9fe581319cdc');
             expect(droplets[1].bucketIdentifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
@@ -223,200 +218,150 @@ describe('NfRegistry Service API w/ Angular testing utils', function () {
         });
     }));
 
-    it('should GET all droplets across a single bucket.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = [{
-            'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
-            'name': 'Flow #1',
-            'description': 'This is flow #1',
-            'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'createdTimestamp': 1505931890999,
-            'modifiedTimestamp': 1505931890999,
-            'type': 'FLOW',
-            'snapshotMetadata': null,
-            'link': {
-                'params': {
-                    'rel': 'self'
-                },
-                'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
-            }
-        }];
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should GET all droplets across a single bucket.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.getDroplets('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc').subscribe(function (droplets) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/items/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
+        nfRegistryApi.getDroplets('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/items/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush([{
+                'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
+                'name': 'Flow #1',
+                'description': 'This is flow #1',
+                'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'createdTimestamp': 1505931890999,
+                'modifiedTimestamp': 1505931890999,
+                'type': 'FLOW',
+                'snapshotMetadata': null,
+                'link': {
+                    'params': {
+                        'rel': 'self'
+                    },
+                    'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
+                }
+            }]);
+            httpMock.verify();
             expect(droplets.length).toBe(1);
             expect(droplets[0].bucketIdentifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
             expect(droplets[0].name).toEqual('Flow #1');
         });
     }));
 
-    it('should DELETE a droplet.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'delete').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {};
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should DELETE a droplet.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.deleteDroplet('flows/1234').subscribe(function () {
-            //assertions
-            var deleteDropletCall = nfRegistryService.api.http.delete.calls.first()
-            expect(deleteDropletCall.args[0]).toBe('/nifi-registry-api/flows/1234');
+        nfRegistryApi.deleteDroplet('flows/1234').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/flows/1234');
+            expect(req.request.method).toEqual('DELETE');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({});
+            httpMock.verify();
         });
     }));
 
-    it('should POST to create a new bucket.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
+    it('should POST to create a new bucket.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         //Spy
-        spyOn(nfRegistryService.api.http, 'post').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {
-            identifier: '1234'
-        };
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
+        spyOn(nfRegistryApi.http, 'post').and.callThrough();
 
         // The function to test
-        nfRegistryService.api.createBucket('test').subscribe(function (bucket) {
-            //assertions
-            var createDropletCall = nfRegistryService.api.http.post.calls.first();
-            expect(createDropletCall.args[0]).toBe('/nifi-registry-api/buckets');
+        nfRegistryApi.createBucket('test').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/buckets');
+            expect(req.request.method).toEqual('POST');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({
+                identifier: '1234'
+            });
+            httpMock.verify();
             expect(createDropletCall.args[1].name).toBe('test');
             expect(bucket.identifier).toBe('1234');
         });
     }));
 
-    it('should DELETE a bucket.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
+    it('should DELETE a bucket.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         //Spy
-        spyOn(nfRegistryService.api.http, 'delete').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {};
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
+        spyOn(nfRegistryApi.http, 'post').and.callThrough();
 
         // The function to test
-        nfRegistryService.api.deleteBucket('1234').subscribe(function () {
-            //assertions
-            var deleteBucketCall = nfRegistryService.api.http.delete.calls.first()
-            expect(deleteBucketCall.args[0]).toBe('/nifi-registry-api/buckets/1234');
+        nfRegistryApi.deleteBucket('1234').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/buckets/1234');
+            expect(req.request.method).toEqual('DELETE');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({});
+            httpMock.verify();
         });
     }));
 
-    it('should GET bucket by ID.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = {
-            'identifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'name': 'Bucket #1'
-        };
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
+    it('should GET bucket by ID.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
 
         // The function to test
-        nfRegistryService.api.getBucket('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc').subscribe(function (bucket) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/buckets/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
-            expect(bucket.identifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
-            expect(bucket.name).toEqual('Bucket #1');
+        nfRegistryApi.getBucket('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc').subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/buckets/2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush({
+                'identifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'name': 'Bucket #1'
+            });
+            httpMock.verify();
+            expect(response.identifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
+            expect(response.name).toEqual('Bucket #1');
         });
     }));
 
-    it('should GET metadata for all buckets in the registry for which the client is authorized.', ngCoreTesting.inject([ngHttp.XHRBackend], function (mockBackend) {
-        fixture = ngCoreTesting.TestBed.createComponent(NfRegistry);
-        fixture.detectChanges();
-        comp = fixture.componentInstance;
-
-        // NfRegistryService from the root injector
-        nfRegistryService = ngCoreTesting.TestBed.get(NfRegistryService);
-
-        //Spy
-        spyOn(nfRegistryService.api.http, 'get').and.callThrough();
-
-        //Setup the mock backend to return mock data
-        var mockResponse = [{
-            'identifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
-            'name': 'Bucket #1'
-        }];
-        mockBackend.connections.subscribe(function (connection) {
-            // This is called every time someone subscribes to an http call
-            connection.mockRespond(new ngHttp.Response(new ngHttp.ResponseOptions({
-                body: JSON.stringify(mockResponse)
-            })));
-        });
-
+    it('should GET metadata for all buckets in the registry for which the client is authorized.', ngCoreTesting.inject([ngCommonHttpTesting.HttpTestingController], function (httpMock) {
         // The function to test
-        nfRegistryService.api.getBuckets().subscribe(function (buckets) {
-            //assertions
-            expect(nfRegistryService.api.http.get).toHaveBeenCalledWith('/nifi-registry-api/buckets');
-            expect(buckets[0].identifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
-            expect(buckets[0].name).toEqual('Bucket #1');
+        nfRegistryApi.getBuckets().subscribe(function(response) {
+            var req = httpMock.expectOne('/nifi-registry-api/access/token/kerberos');
+            req.flush({});
+            req = httpMock.expectOne('/nifi-registry-api/access');
+            req.flush({});
+            httpMock.verify();
+            // the request it made
+            req = httpMock.expectOne('/nifi-registry-api/buckets');
+            expect(req.request.method).toEqual('GET');
+
+            // Next, fulfill the request by transmitting a response.
+            req.flush([{
+                'identifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
+                'name': 'Bucket #1'
+            }]);
+            httpMock.verify();
+            expect(response[0].identifier).toEqual('2f7f9e54-dc09-4ceb-aa58-9fe581319cdc');
+            expect(response[0].name).toEqual('Bucket #1');
         });
     }));
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/247985ad/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth.service.js
----------------------------------------------------------------------
diff --git a/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth.service.js b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth.service.js
new file mode 100644
index 0000000..789988d
--- /dev/null
+++ b/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth.service.js
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var NfStorage = require('nifi-registry/services/nf-storage.service.js');
+
+/**
+ * NfRegistryAuth constructor.
+ *
+ * @param nfStorage             The NfStorage module.
+ * @constructor
+ */
+function NfRegistryAuth(nfStorage) {
+    this.nfStorage = nfStorage;
+};
+
+NfRegistryAuth.prototype = {
+    constructor: NfRegistryAuth,
+
+    /**
+     * Gets the jwt token.
+     * @returns {*}
+     */
+    getToken: function() {
+        return this.nfStorage.getItem('jwt');
+    }
+};
+
+NfRegistryAuth.parameters = [
+    NfStorage
+];
+
+module.exports = NfRegistryAuth;


Mime
View raw message