diff --git a/docs/core/services/authentication.service.md b/docs/core/services/authentication.service.md index 383318e61f..c460dc8a06 100644 --- a/docs/core/services/authentication.service.md +++ b/docs/core/services/authentication.service.md @@ -50,10 +50,6 @@ Provides authentication to ACS and APS. - **isALLProvider**(): `boolean`
Does the provider support both ECM and BPM? - **Returns** `boolean` - True if both are supported, false otherwise -- **isAuthCodeFlow**(): `boolean`
- - - **Returns** `boolean` - - - **isBPMProvider**(): `boolean`
Does the provider support BPM? - **Returns** `boolean` - True if supported, false otherwise @@ -66,10 +62,6 @@ Provides authentication to ACS and APS. - **isEcmLoggedIn**(): `boolean`
Checks if the user is logged in on an ECM provider. - **Returns** `boolean` - True if logged in, false otherwise -- **isImplicitFlow**(): `boolean`
- - - **Returns** `boolean` - - - **isKerberosEnabled**(): `boolean`
Does kerberos enabled? - **Returns** `boolean` - True if enabled, false otherwise diff --git a/lib/core/src/lib/auth/basic-auth/basic-alfresco-auth.service.ts b/lib/core/src/lib/auth/basic-auth/basic-alfresco-auth.service.ts index 69f9938537..62a2384217 100644 --- a/lib/core/src/lib/auth/basic-auth/basic-alfresco-auth.service.ts +++ b/lib/core/src/lib/auth/basic-auth/basic-alfresco-auth.service.ts @@ -317,14 +317,27 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService { return this.redirectUrl && (this.redirectUrl.provider === 'ALL' || provider === 'ALL'); } + /** + * @deprecated use `getUsername()` instead + * @returns the username of the authenticated user + */ getBpmUsername(): string { return this.processAuth.getUsername(); } + /** + * @deprecated use `getUsername()` instead + * @returns the username of the authenticated user + */ getEcmUsername(): string { return this.contentAuth.getUsername(); } + /** + * Gets the username of the authenticated user. + * + * @returns the username of the authenticated user + */ getUsername(): string { if (this.isBPMProvider()) { return this.processAuth.getUsername(); 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 5e17f95fc2..9d0eb77fdf 100644 --- a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts +++ b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts @@ -82,16 +82,6 @@ export class OidcAuthenticationService extends BaseAuthenticationService { return this.oauthService.hasValidIdToken(); } - isImplicitFlow() { - const oauth2: OauthConfigModel = Object.assign({}, this.appConfig.get(AppConfigValues.OAUTHCONFIG, null)); - return !!oauth2?.implicitFlow; - } - - isAuthCodeFlow() { - const oauth2: OauthConfigModel = Object.assign({}, this.appConfig.get(AppConfigValues.OAUTHCONFIG, null)); - return !!oauth2?.codeFlow; - } - login(username: string, password: string): Observable<{ type: string; ticket: any }> { return this.auth.baseAuthLogin(username, password).pipe( map((response) => { @@ -125,12 +115,17 @@ export class OidcAuthenticationService extends BaseAuthenticationService { }); } + /** + * Gets the username of the authenticated user. + * + * @returns the logged username + */ getUsername() { return this.jwtHelperService.getValueFromLocalToken(JwtHelperService.USER_PREFERRED_USERNAME); } /** - * @deprecated + * @deprecated use `getUsername` instead * @returns the logged username */ getEcmUsername(): string { @@ -138,7 +133,7 @@ export class OidcAuthenticationService extends BaseAuthenticationService { } /** - * @deprecated + * @deprecated use `getUsername` instead * @returns the logged username */ getBpmUsername(): string { @@ -149,10 +144,6 @@ export class OidcAuthenticationService extends BaseAuthenticationService { this.auth.login(redirectUrl); } - ssoCodeFlowLogin() { - this.oauthService.initCodeFlow(); - } - isRememberMeSet(): boolean { return true; } diff --git a/lib/core/src/lib/auth/services/authentication.service.ts b/lib/core/src/lib/auth/services/authentication.service.ts index 6500a81b14..31b437db13 100644 --- a/lib/core/src/lib/auth/services/authentication.service.ts +++ b/lib/core/src/lib/auth/services/authentication.service.ts @@ -149,6 +149,8 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee } /** + * Gets the username of the authenticated user. + * * @returns the username of the authenticated user */ getUsername(): string { @@ -160,7 +162,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee } /** - * @deprecated + * @deprecated use `getUsername` instead * @returns the logged username */ getEcmUsername(): string { @@ -172,7 +174,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee } /** - * @deprecated + * @deprecated use `getUsername` instead * @returns the logged username */ getBpmUsername(): string { diff --git a/lib/core/src/lib/auth/services/base-authentication.service.ts b/lib/core/src/lib/auth/services/base-authentication.service.ts index b43e2592ed..f7f9be6ad7 100644 --- a/lib/core/src/lib/auth/services/base-authentication.service.ts +++ b/lib/core/src/lib/auth/services/base-authentication.service.ts @@ -40,21 +40,24 @@ export abstract class BaseAuthenticationService implements AuthenticationService } abstract getAuthHeaders(requestUrl: string, header: HttpHeaders): HttpHeaders; - abstract getToken(): string; - abstract isLoggedIn(): boolean; - abstract logout(): any; + /** @deprecated use `isLoggedIn` instead */ abstract isEcmLoggedIn(): boolean; + /** @deprecated use `isLoggedIn` instead */ abstract isBpmLoggedIn(): boolean; abstract reset(): void; + abstract getUsername(): string; + + /** @deprecated use `getUsername` instead */ abstract getEcmUsername(): string; + /** @deprecated use `getUsername` instead */ abstract getBpmUsername(): string; /** @@ -110,11 +113,6 @@ export abstract class BaseAuthenticationService implements AuthenticationService return provider && provider.toUpperCase() === 'ALL'; } - isOauthConfiguration(): boolean { - const authType = this.appConfig.get('authType') as string; - return authType === 'OAUTH'; - } - /** * Prints an error message in the console browser *