mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
[ADF-2200] fixed redirectUrl check (#2886)
This commit is contained in:
parent
657c28491a
commit
0ad4bf6eb9
@ -270,6 +270,12 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[ECM] should return null as redirectUrl when redirectUrl field is not set', () => {
|
||||||
|
authService.setRedirectUrl( null );
|
||||||
|
|
||||||
|
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the setting is BPM', () => {
|
describe('when the setting is BPM', () => {
|
||||||
@ -391,6 +397,12 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[BPM] should return null as redirectUrl when redirectUrl field is not set', () => {
|
||||||
|
authService.setRedirectUrl( null );
|
||||||
|
|
||||||
|
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the setting is both ECM and BPM ', () => {
|
describe('when the setting is both ECM and BPM ', () => {
|
||||||
@ -503,6 +515,12 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
|
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[ALL] should return null as redirectUrl when redirectUrl field is not set', () => {
|
||||||
|
authService.setRedirectUrl( null );
|
||||||
|
|
||||||
|
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -239,15 +239,15 @@ export class AuthenticationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRedirectUrl(provider: string): string {
|
getRedirectUrl(provider: string): string {
|
||||||
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
|
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasValidRedirection(provider: string): boolean {
|
private hasValidRedirection(provider: string): boolean {
|
||||||
return this.redirectUrl && this.redirectUrl.provider === provider || this.hasSelectedProviderAll(provider);
|
return this.redirectUrl && (this.redirectUrl.provider === provider || this.hasSelectedProviderAll(provider));
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasSelectedProviderAll(provider: string): boolean {
|
private hasSelectedProviderAll(provider: string): boolean {
|
||||||
return this.redirectUrl && this.redirectUrl.provider === 'ALL' || provider === 'ALL';
|
return this.redirectUrl && (this.redirectUrl.provider === 'ALL' || provider === 'ALL');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user