[ADF-2200] fixed problem with redirection url (#2877)

* [ADF-2200] fixed wrong handling of redirectUrl

* [ADF-2200] fixed problem with redirection url

* [ADF-2200] fixed redirection config path

* [ADF-2200] fixed wrong fdescribe test

* [ADF-2200] removed authserviceMock and fixed some tests
This commit is contained in:
Vito
2018-01-25 12:48:47 +01:00
committed by Eugenio Romano
parent 9f88c02ef3
commit 77f6c51dc2
14 changed files with 255 additions and 100 deletions

View File

@@ -26,13 +26,14 @@ import { UserPreferencesService } from './user-preferences.service';
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
import { RedirectionModel } from '../models/redirection.model';
const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME';
const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30 ;
@Injectable()
export class AuthenticationService {
private redirectUrl: string = '';
private redirectUrl: RedirectionModel = null;
onLogin: Subject<any> = new Subject<any>();
onLogout: Subject<any> = new Subject<any>();
@@ -233,12 +234,20 @@ export class AuthenticationService {
return this.alfrescoApi.getInstance().bpmAuth.username;
}
setRedirectUrl(url: string) {
setRedirectUrl(url: RedirectionModel) {
this.redirectUrl = url;
}
getRedirectUrl(): string {
return this.redirectUrl;
getRedirectUrl(provider: string): string {
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
}
private hasValidRedirection(provider: string): boolean {
return this.redirectUrl && this.redirectUrl.provider === provider || this.hasSelectedProviderAll(provider);
}
private hasSelectedProviderAll(provider: string): boolean {
return this.redirectUrl && this.redirectUrl.provider === 'ALL' || provider === 'ALL';
}
/**