mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-24 14:31:41 +00:00
Fix authentication ticket for BPM
- for now basic auth is used as a token
This commit is contained in:
@@ -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')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user