mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user