diff --git a/demo-shell/src/app/components/lazy-loading/lazy-loading.component.ts b/demo-shell/src/app/components/lazy-loading/lazy-loading.component.ts index 90acd39cdb..0b1d19f586 100644 --- a/demo-shell/src/app/components/lazy-loading/lazy-loading.component.ts +++ b/demo-shell/src/app/components/lazy-loading/lazy-loading.component.ts @@ -27,7 +27,6 @@ import { ObjectDataTableAdapter, AuthenticationService } from '@alfresco/adf-cor
  • Global i18n: {{ 'APP_LAYOUT.DATATABLE_LAZY' | translate }}
  • Local i18n (work in progress): {{ 'LAZY.TEXT' | translate }}
  • isLoggedIn: {{ isLoggedIn }}
  • -
  • ECM username: {{ username }} ` }) @@ -39,10 +38,6 @@ export class LazyLoadingComponent { return this.auth.isLoggedIn(); } - get username(): string { - return this.auth.getEcmUsername(); - } - constructor(private auth: AuthenticationService) { this.data = new ObjectDataTableAdapter( // data diff --git a/lib/content-services/src/lib/common/services/content.service.ts b/lib/content-services/src/lib/common/services/content.service.ts index 1ee74766f1..7d57ec0464 100644 --- a/lib/content-services/src/lib/common/services/content.service.ts +++ b/lib/content-services/src/lib/common/services/content.service.ts @@ -87,7 +87,7 @@ export class ContentService { */ hasPermissions(node: Node, permission: PermissionsEnum | string, userId?: string): boolean { let hasPermissions = false; - userId = userId ?? this.authService.getEcmUsername(); + userId = userId ?? this.apiService.getInstance().getEcmUsername(); const permissions = [...(node.permissions?.locallySet || []), ...(node.permissions?.inherited || [])] .filter((currentPermission) => currentPermission.authorityId === userId); diff --git a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts index ca9da6640c..ee400af07e 100644 --- a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts +++ b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts @@ -22,7 +22,7 @@ import { catchError, filter, map } from 'rxjs/operators'; import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; import { OauthConfigModel } from '../models/oauth-config.model'; import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { BaseAuthenticationService } from '../../services/base-authentication.service'; +import { BaseAuthenticationService } from '../services/base-authentication.service'; import { CookieService } from '../../common/services/cookie.service'; import { JwtHelperService } from '../services/jwt-helper.service'; import { LogService } from '../../common/services/log.service'; diff --git a/lib/core/src/lib/auth/services/authentication.service.ts b/lib/core/src/lib/auth/services/authentication.service.ts index 025f91518e..73e69fa827 100644 --- a/lib/core/src/lib/auth/services/authentication.service.ts +++ b/lib/core/src/lib/auth/services/authentication.service.ts @@ -24,8 +24,7 @@ import { AppConfigService, AppConfigValues } from '../../app-config/app-config.s import { map, catchError, tap } from 'rxjs/operators'; import { JwtHelperService } from './jwt-helper.service'; import { StorageService } from '../../common/services/storage.service'; -import { OauthConfigModel } from '../models/oauth-config.model'; -import { BaseAuthenticationService } from '../../services/base-authentication.service'; +import { BaseAuthenticationService } from './base-authentication.service'; @Injectable({ providedIn: 'root' @@ -161,33 +160,6 @@ export class AuthenticationService extends BaseAuthenticationService { return false; } - /** - * Gets the ECM username. - * - * @returns The ECM username - */ - getEcmUsername(): string { - return this.alfrescoApi.getInstance().getEcmUsername(); - } - - /** - * Gets the BPM username - * - * @returns The BPM username - */ - getBpmUsername(): string { - return this.alfrescoApi.getInstance().getBpmUsername(); - } - - isImplicitFlow(): boolean { - const oauth2: OauthConfigModel = Object.assign({}, this.appConfig.get(AppConfigValues.OAUTHCONFIG, null)); - return !!oauth2?.implicitFlow; - } - - isAuthCodeFlow(): boolean { - return false; - } - /** * Gets the auth token. * diff --git a/lib/core/src/lib/services/base-authentication.service.ts b/lib/core/src/lib/auth/services/base-authentication.service.ts similarity index 84% rename from lib/core/src/lib/services/base-authentication.service.ts rename to lib/core/src/lib/auth/services/base-authentication.service.ts index dfd22e829a..f3e52c8b16 100644 --- a/lib/core/src/lib/services/base-authentication.service.ts +++ b/lib/core/src/lib/auth/services/base-authentication.service.ts @@ -15,14 +15,13 @@ * limitations under the License. */ -import { PeopleApi, UserProfileApi, UserRepresentation } from '@alfresco/js-api'; import { HttpHeaders } from '@angular/common/http'; -import { RedirectionModel } from '../auth/models/redirection.model'; -import { from, Observable, Observer, ReplaySubject, throwError } from 'rxjs'; -import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { CookieService } from '../common/services/cookie.service'; -import { LogService } from '../common/services/log.service'; +import { RedirectionModel } from '../models/redirection.model'; +import { Observable, Observer, ReplaySubject, throwError } from 'rxjs'; +import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { CookieService } from '../../common/services/cookie.service'; +import { LogService } from '../../common/services/log.service'; const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME'; const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30; @@ -34,18 +33,6 @@ export abstract class BaseAuthenticationService { onLogin = new ReplaySubject(1); onLogout = new ReplaySubject(1); - _peopleApi: PeopleApi; - get peopleApi(): PeopleApi { - this._peopleApi = this._peopleApi ?? new PeopleApi(this.alfrescoApi.getInstance()); - return this._peopleApi; - } - - _profileApi: UserProfileApi; - get profileApi(): UserProfileApi { - this._profileApi = this._profileApi ?? new UserProfileApi(this.alfrescoApi.getInstance()); - return this._profileApi; - } - constructor( protected alfrescoApi: AlfrescoApiService, protected appConfig: AppConfigService, @@ -58,15 +45,11 @@ export abstract class BaseAuthenticationService { abstract isLoggedIn(): boolean; abstract isLoggedInWith(provider: string): boolean; abstract isOauth(): boolean; - abstract isImplicitFlow(): boolean; - abstract isAuthCodeFlow(): boolean; abstract login(username: string, password: string, rememberMe?: boolean): Observable<{ type: string; ticket: any }>; abstract ssoImplicitLogin(): void; abstract logout(): Observable; abstract isEcmLoggedIn(): boolean; abstract isBpmLoggedIn(): boolean; - abstract getEcmUsername(): string; - abstract getBpmUsername(): string; abstract reset(): void; abstract once(event: string): Observable; @@ -192,15 +175,6 @@ export abstract class BaseAuthenticationService { return null; } - /** - * Gets information about the user currently logged into APS. - * - * @returns User information - */ - getBpmLoggedUser(): Observable { - return from(this.profileApi.getProfile()); - } - /** * Prints an error message in the console browser *