Fix authentication mock

This commit is contained in:
mauriziovitale84 2016-06-24 11:04:55 +01:00
parent 0895106441
commit 3d748b61b5

View File

@ -16,14 +16,17 @@
*/
import { Observable } from 'rxjs/Rx';
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
// TODO: should be extending AlfrescoAuthenticationService
export class AuthenticationMock /*extends AlfrescoAuthenticationService*/ {
export class AuthenticationMock extends AlfrescoAuthenticationService {
// TODO: real auth service returns Observable<string>
login(username: string, password: string): Observable<boolean> {
constructor(settings: AlfrescoSettingsService = null) {
super(settings);
}
login(username: string, password: string): Observable<string> {
if (username === 'fake-username' && password === 'fake-password') {
return Observable.of(true);
return Observable.of('fake-token');
} else {
return Observable.throw('Fake server error');
}