Commit 3ca0ba5c authored by zheng liu's avatar zheng liu

Merged in dev (pull request #74)

feat: add debug
parents e5e5191d b716eadc
......@@ -74,6 +74,14 @@ export class HttpService {
const body = new HttpParams()
.set('username', user_id)
.set('password', 'jumpserver');
// {
// "authToken": "xxxxxxx",
// "username": "xxxxxx",
// "dataSource": "jumpserver",
// "availableDataSources":[
// "jumpserver"
// ]
// }
return this.http.post('/guacamole/api/tokens',
body.toString(),
{headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')});
......@@ -94,10 +102,10 @@ export class HttpService {
);
}
guacamole_token_add_asset(token: string) {
guacamole_token_add_asset(assetToken: string, token: string) {
const params = new HttpParams()
.set('asset_token', token)
.set('token', DataStore.guacamole_token);
.set('asset_token', assetToken)
.set('token', token);
return this.http.get(
'/guacamole/api/session/ext/jumpserver/asset/token/add',
{
......
......@@ -5,6 +5,7 @@ import {DataStore, User} from '../../globals';
import {DomSanitizer} from '@angular/platform-browser';
import {environment} from '../../../environments/environment';
import {NavList} from '../../ControlPage/control/control.component';
import {logger} from 'codelyzer/util/logger';
@Component({
selector: 'app-element-guacamole',
......@@ -33,9 +34,10 @@ export class ElementGuacamoleComponent implements OnInit {
this._http.get_guacamole_token(this.userid).subscribe(
data => {
DataStore.guacamole_token = data['authToken'];
this._http.guacamole_token_add_asset(this.token).subscribe(
_ => {
this.target = document.location.origin + '/guacamole/#/client/' + data['result'] + '?token=' + DataStore.guacamole_token;
this._http.guacamole_token_add_asset(this.token, data['authToken']).subscribe(
data2 => {
this._logger.debug(data);
this.target = document.location.origin + '/guacamole/#/client/' + data2['result'] + '?token=' + data['authToken'];
},
error2 => {
this._logger.error(error2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment