Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Authenticate web sockets using persona and token.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtho11 committed Sep 11, 2015
1 parent 5681d7c commit 875d1e8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion console/src/main/scripts/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ngInfiniteScroll": "1.2.1",
"bootstrap-select": "1.6",
"hawkular-charts": "0.5.1",
"hawkular-ui-services": "0.6.12",
"hawkular-ui-services": "0.8.0",
"hawtio-core-navigation": "2.0.51",
"hawtio-core": "2.0.18",
"hawtio-template-cache": "2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ module HawkularMetrics {
public static $inject = ['$rootScope', '$scope', '$q', '$timeout', '$log', 'HawkularOps',
'$modalInstance', 'NotificationsService', '$routeParams', 'HawkularInventory'];

private _resourcePath:IResourcePath;


public deploymentData:IDeploymentData =
{
Expand All @@ -61,11 +59,10 @@ module HawkularMetrics {
hasDeploymentError: false,
hasDeployedSuccessfully: false,
editDeploymentFiles: false,
/// Not sure why it wont let me use the const DEPLOYMENT_NOT_STARTED here :/
deploymentStatus: 0
};

constructor(private $rootScope:IHawkularRootScope,
constructor(private $rootScope:any,
private $scope:ng.IScope,
private $q:ng.IQService,
private $timeout:ng.ITimeoutService,
Expand All @@ -85,22 +82,18 @@ module HawkularMetrics {
feedId: this.$routeParams.resourceId.split('~')[0],
resourcePath: this.$routeParams.resourceId + '~~'
}, (resource:IResourcePath) => {
this._resourcePath = resource;
this.deploymentData.resourcePath = resource.path;
});

$scope.$on('DeploymentAddSuccess', (event, data) => {
this.$log.info('Deployment Add Succeeded!');
console.dir(data);
this.deploymentData.uploading = false;
this.deploymentData.hasDeployedSuccessfully = true;
this.deploymentData.hasDeploymentError = false;

console.dir(data);
});
$scope.$on('DeploymentAddError', (event, data) => {
this.$log.info('Deployment Add Failed!');
console.dir(data);
this.deploymentData.uploading = false;
this.deploymentData.hasDeploymentError = true;
this.deploymentData.hasDeployedSuccessfully = false;
Expand All @@ -127,23 +120,11 @@ module HawkularMetrics {
this.deploymentData.uploading = true;
this.$log.log('Deploying file: ' + this.deploymentData.runtimeFileName);
this.HawkularOps.performAddDeployOperation(this.deploymentData.resourcePath,
this.deploymentData.runtimeFileName, this.deploymentData.binaryFile);
this.deploymentData.runtimeFileName, this.deploymentData.binaryFile, this.$rootScope.userDetails.token,
this.$rootScope.currentPersona.id);

}

public finishedDeployWizard():void {
this.$modalInstance.close('ok');
}

public testErrorEvent() {
this.$rootScope.$broadcast('DeploymentAddError', 'Hi there is an err');
}

public testSuccessEvent() {
this.$rootScope.$broadcast('DeploymentAddSuccess', 'Hi Success');
}


}

_module.controller('AppServerDeploymentsAddDialogController', AppServerDeploymentsAddDialogController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module HawkularMetrics {
});
}

public getResourceListForOneFeed(feedId: string, currentTenantId?: TenantId):any {
public getResourceListForOneFeed(feedId: FeedId, currentTenantId?: TenantId):any {
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
this.HawkularInventory.ResourceOfTypeUnderFeed.query({
environmentId: globalEnvironmentId, feedId: feedId,
Expand Down
17 changes: 17 additions & 0 deletions console/src/main/scripts/plugins/metrics/ts/metricsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,32 @@ module HawkularMetrics {
/// Value types
export type TimestampInMillis = number;
export type IntervalInSeconds = number;
export type AuthenticationToken = string;


/// Interface Definitions
export interface IPersona {
id: PersonaId;
name: string;
createdAt: string;
updatedAt: string;
}

export interface IUserDetails {
email:string;
emailVerified: boolean;
enabled:boolean;
firstName:string;
id:string;
lastName:string;
token:string;
totp: boolean;
username:string;
}

export interface IHawkularRootScope extends ng.IRootScopeService {
currentPersona:IPersona;
userDetails:IUserDetails;
}

}

0 comments on commit 875d1e8

Please sign in to comment.