mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-22334] ADW - User information not displayed when Kerberos is in use (#7172)
* [MNT-22334] ADW - User information not displayed when Kerberos is in use * * enable kerberos * * added test * Revert "* enable kerberos"
This commit is contained in:
@@ -65,6 +65,7 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
appConfigService.config.providers = 'ECM';
|
appConfigService.config.providers = 'ECM';
|
||||||
|
appConfigService.config.auth = { withCredentials: false };
|
||||||
appConfigService.load();
|
appConfigService.load();
|
||||||
apiService.reset();
|
apiService.reset();
|
||||||
});
|
});
|
||||||
@@ -186,12 +187,20 @@ describe('AuthenticationService', () => {
|
|||||||
it('[ECM] should return isBpmLoggedIn false', () => {
|
it('[ECM] should return isBpmLoggedIn false', () => {
|
||||||
expect(authService.isBpmLoggedIn()).toBe(false);
|
expect(authService.isBpmLoggedIn()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[ECM] should return true if kerberos configured', () => {
|
||||||
|
appConfigService.config.auth.withCredentials = true ;
|
||||||
|
|
||||||
|
expect(authService.isLoggedInWith('ECM')).toBe(true);
|
||||||
|
expect(authService.isLoggedIn()).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the setting is BPM', () => {
|
describe('when the setting is BPM', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
appConfigService.config.providers = 'BPM';
|
appConfigService.config.providers = 'BPM';
|
||||||
|
appConfigService.config.auth = { withCredentials: false };
|
||||||
appConfigService.load();
|
appConfigService.load();
|
||||||
apiService.reset();
|
apiService.reset();
|
||||||
});
|
});
|
||||||
@@ -321,6 +330,7 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
appConfigService.config.providers = 'ECM';
|
appConfigService.config.providers = 'ECM';
|
||||||
|
appConfigService.config.auth = { withCredentials: false };
|
||||||
appConfigService.load();
|
appConfigService.load();
|
||||||
apiService.reset();
|
apiService.reset();
|
||||||
});
|
});
|
||||||
@@ -385,6 +395,7 @@ describe('AuthenticationService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
appConfigService.config.providers = 'ALL';
|
appConfigService.config.providers = 'ALL';
|
||||||
|
appConfigService.config.auth = { withCredentials: false };
|
||||||
appConfigService.load();
|
appConfigService.load();
|
||||||
apiService.reset();
|
apiService.reset();
|
||||||
});
|
});
|
||||||
|
@@ -64,6 +64,10 @@ export class AuthenticationService {
|
|||||||
* @returns True if logged in, false otherwise
|
* @returns True if logged in, false otherwise
|
||||||
*/
|
*/
|
||||||
isLoggedIn(): boolean {
|
isLoggedIn(): boolean {
|
||||||
|
if (this.isKerberosConfigured()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
|
if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -224,6 +228,10 @@ export class AuthenticationService {
|
|||||||
* @returns True if logged in, false otherwise
|
* @returns True if logged in, false otherwise
|
||||||
*/
|
*/
|
||||||
isEcmLoggedIn(): boolean {
|
isEcmLoggedIn(): boolean {
|
||||||
|
if (this.isKerberosConfigured()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isECMProvider() || this.isALLProvider()) {
|
if (this.isECMProvider() || this.isALLProvider()) {
|
||||||
if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
|
if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -247,6 +255,10 @@ export class AuthenticationService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isKerberosConfigured(): boolean {
|
||||||
|
return this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ECM username.
|
* Gets the ECM username.
|
||||||
* @returns The ECM username
|
* @returns The ECM username
|
||||||
|
Reference in New Issue
Block a user