Fix authentication ticket for BPM

- for now basic auth is used as a token
This commit is contained in:
Denys Vuika
2016-07-28 10:11:42 +01:00
parent 037825f0cf
commit 6a2899d480
2 changed files with 7 additions and 2 deletions

View File

@@ -18,6 +18,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Response, Http, Headers, RequestOptions } from '@angular/http'; import { Response, Http, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
import { FormValues } from './../components/widgets/widget.model'; import { FormValues } from './../components/widgets/widget.model';
import { AlfrescoSettingsService } from 'ng2-alfresco-core'; import { AlfrescoSettingsService } from 'ng2-alfresco-core';
@@ -25,6 +26,7 @@ import { AlfrescoSettingsService } from 'ng2-alfresco-core';
export class FormService { export class FormService {
constructor(private http: Http, constructor(private http: Http,
private authService: AlfrescoAuthenticationService,
private alfrescoSettingsService: AlfrescoSettingsService) { private alfrescoSettingsService: AlfrescoSettingsService) {
} }
@@ -98,7 +100,7 @@ export class FormService {
return new Headers({ return new Headers({
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('admin' + ':' + 'admin') 'Authorization': this.authService.getTicket('BPM')
}); });
} }

View File

@@ -44,7 +44,10 @@ export class AlfrescoAuthenticationBPM extends AlfrescoAuthenticationBase implem
login(username: string, password: string): Observable<any> { login(username: string, password: string): Observable<any> {
return Observable.fromPromise(this.apiActivitiLogin(username, password)) return Observable.fromPromise(this.apiActivitiLogin(username, password))
.map((response: any) => { .map((response: any) => {
return {type: this.TYPE, ticket: response.status}; return {
type: this.TYPE,
ticket: 'Basic ' + btoa(`${username}:${password}`)
};
}) })
.catch(this.handleError); .catch(this.handleError);
} }