Skip to content

Commit

Permalink
[MNT-22334] ADW - User information not displayed when Kerberos is in …
Browse files Browse the repository at this point in the history
…use (#7172)

* [MNT-22334] ADW - User information not displayed when Kerberos is in use

* * enable kerberos

* * added test

* Revert "* enable kerberos"
  • Loading branch information
dhrn committed Aug 2, 2021
1 parent 94d908e commit 4befb77
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/core/services/authentication.service.spec.ts
Expand Up @@ -65,6 +65,7 @@ describe('AuthenticationService', () => {

beforeEach(() => {
appConfigService.config.providers = 'ECM';
appConfigService.config.auth = { withCredentials: false };
appConfigService.load();
apiService.reset();
});
Expand Down Expand Up @@ -186,12 +187,20 @@ describe('AuthenticationService', () => {
it('[ECM] should return isBpmLoggedIn 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', () => {

beforeEach(() => {
appConfigService.config.providers = 'BPM';
appConfigService.config.auth = { withCredentials: false };
appConfigService.load();
apiService.reset();
});
Expand Down Expand Up @@ -321,6 +330,7 @@ describe('AuthenticationService', () => {

beforeEach(() => {
appConfigService.config.providers = 'ECM';
appConfigService.config.auth = { withCredentials: false };
appConfigService.load();
apiService.reset();
});
Expand Down Expand Up @@ -385,6 +395,7 @@ describe('AuthenticationService', () => {

beforeEach(() => {
appConfigService.config.providers = 'ALL';
appConfigService.config.auth = { withCredentials: false };
appConfigService.load();
apiService.reset();
});
Expand Down
12 changes: 12 additions & 0 deletions lib/core/services/authentication.service.ts
Expand Up @@ -64,6 +64,10 @@ export class AuthenticationService {
* @returns True if logged in, false otherwise
*/
isLoggedIn(): boolean {
if (this.isKerberosConfigured()) {
return true;
}

if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
return false;
}
Expand Down Expand Up @@ -224,6 +228,10 @@ export class AuthenticationService {
* @returns True if logged in, false otherwise
*/
isEcmLoggedIn(): boolean {
if (this.isKerberosConfigured()) {
return true;
}

if (this.isECMProvider() || this.isALLProvider()) {
if (!this.isOauth() && this.cookie.isEnabled() && !this.isRememberMeSet()) {
return false;
Expand All @@ -247,6 +255,10 @@ export class AuthenticationService {
return false;
}

isKerberosConfigured(): boolean {
return this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false);
}

/**
* Gets the ECM username.
* @returns The ECM username
Expand Down

0 comments on commit 4befb77

Please sign in to comment.