update api docs and clean dead code

rebasing onto develop branch
This commit is contained in:
Denys Vuika
2024-07-12 12:55:17 -04:00
committed by Anton Ramanovich
parent 1f946ff69a
commit be92d6632f
14 changed files with 157 additions and 71 deletions

View File

@@ -28,7 +28,7 @@ export const AuthGuardBpm: CanActivateFn = async (_: ActivatedRouteSnapshot, sta
return authGuardBaseService.redirectSSOSuccessURL();
}
if (authenticationService.isBpmLoggedIn() || authGuardBaseService.withCredentials) {
if (authenticationService.isLoggedIn() || authGuardBaseService.withCredentials) {
return true;
}

View File

@@ -20,7 +20,6 @@ import ee from 'event-emitter';
import { Observable } from 'rxjs';
export interface AuthenticationServiceInterface {
onError: any;
onLogin: any;
onLogout: any;
@@ -31,30 +30,26 @@ export interface AuthenticationServiceInterface {
emit: (type: string, ...args: any[]) => void;
getToken(): string;
isLoggedIn(): boolean;
isOauth(): boolean;
logout(): any;
isEcmLoggedIn(): boolean;
isBpmLoggedIn(): boolean;
isECMProvider(): boolean;
isBPMProvider(): boolean;
isALLProvider(): boolean;
getEcmUsername(): string;
getBpmUsername(): string;
getUsername(): string;
getAuthHeaders(requestUrl: string, header: HttpHeaders): HttpHeaders;
addTokenToHeader(requestUrl: string, headersArg?: HttpHeaders): Observable<HttpHeaders>;
reset(): void;
/** @deprecated use `isLoggedIn` instead, use `isECMProvider` if you need to know the auth type */
isEcmLoggedIn(): boolean;
/** @deprecated use `isLoggedIn` instead, use `isBPMProvider` if you need to know the auth type */
isBpmLoggedIn(): boolean;
/** @deprecated use `getUsername` instead */
getEcmUsername(): string;
/** @deprecated use `getUsername` instead */
getBpmUsername(): string;
}

View File

@@ -56,6 +56,10 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
map(([authenticated, isDiscoveryDocumentLoaded]) => !authenticated && isDiscoveryDocumentLoaded)
);
/**
* @deprecated use `isLoggedIn` instead
* @returns true if the ECM provider is logged in
*/
isEcmLoggedIn(): boolean {
if (this.isECMProvider() || this.isALLProvider()) {
return this.isLoggedIn();
@@ -63,6 +67,10 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
return false;
}
/**
* @deprecated use `isLoggedIn` instead
* @returns true if the BPM provider is logged in
*/
isBpmLoggedIn(): boolean {
if (this.isBPMProvider() || this.isALLProvider()) {
return this.isLoggedIn();

View File

@@ -116,6 +116,10 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
}
}
/**
* @deprecated use `isLoggedIn` instead
* @returns true if the ECM provider is logged in
*/
isEcmLoggedIn(): boolean {
if (this.isOauth()) {
return this.oidcAuthenticationService.isEcmLoggedIn();
@@ -124,6 +128,10 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
}
}
/**
* @deprecated use `isLoggedIn` instead
* @returns true if the BPM provider is logged in
*/
isBpmLoggedIn(): boolean {
if (this.isOauth()) {
return this.oidcAuthenticationService.isBpmLoggedIn();
@@ -166,11 +174,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
* @returns the logged username
*/
getEcmUsername(): string {
if (this.isOauth()) {
return this.oidcAuthenticationService.getUsername();
} else {
return this.basicAlfrescoAuthService.getEcmUsername();
}
return this.getUsername();
}
/**
@@ -178,11 +182,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
* @returns the logged username
*/
getBpmUsername(): string {
if (this.isOauth()) {
return this.oidcAuthenticationService.getUsername();
} else {
return this.basicAlfrescoAuthService.getBpmUsername();
}
return this.getUsername();
}
getAuthHeaders(requestUrl: string, headers: HttpHeaders): HttpHeaders {

View File

@@ -51,7 +51,6 @@ export abstract class BaseAuthenticationService implements AuthenticationService
abstract isBpmLoggedIn(): boolean;
abstract reset(): void;
abstract getUsername(): string;
/** @deprecated use `getUsername` instead */