mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
update api docs and clean dead code
rebasing onto develop branch
This commit is contained in:
committed by
Anton Ramanovich
parent
1f946ff69a
commit
be92d6632f
@@ -0,0 +1,112 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { EcmUserModel, PeopleContentService } from '@alfresco/adf-content-services';
|
||||||
|
import { PeopleProcessService } from '@alfresco/adf-process-services';
|
||||||
|
import { AuthenticationService, BasicAlfrescoAuthService, IdentityUserModel, IdentityUserService, UserInfoMode } from '@alfresco/adf-core';
|
||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { MenuPositionX, MenuPositionY } from '@angular/material/menu';
|
||||||
|
import { Observable, of } from 'rxjs';
|
||||||
|
import { UserRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-shell-user-info',
|
||||||
|
templateUrl: './user-info.component.html'
|
||||||
|
})
|
||||||
|
export class UserInfoComponent implements OnInit {
|
||||||
|
/** Custom choice for opening the menu at the bottom. Can be `before` or `after`. */
|
||||||
|
@Input()
|
||||||
|
menuPositionX: MenuPositionX = 'after';
|
||||||
|
|
||||||
|
/** Custom choice for opening the menu at the bottom. Can be `above` or `below`. */
|
||||||
|
@Input()
|
||||||
|
menuPositionY: MenuPositionY = 'below';
|
||||||
|
|
||||||
|
mode: UserInfoMode;
|
||||||
|
ecmUser$: Observable<EcmUserModel>;
|
||||||
|
bpmUser$: Observable<UserRepresentation>;
|
||||||
|
identityUser$: Observable<IdentityUserModel>;
|
||||||
|
userInfoMode = UserInfoMode;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private peopleContentService: PeopleContentService,
|
||||||
|
private peopleProcessService: PeopleProcessService,
|
||||||
|
private identityUserService: IdentityUserService,
|
||||||
|
private basicAlfrescoAuthService: BasicAlfrescoAuthService,
|
||||||
|
private authService: AuthenticationService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.getUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
getUserInfo() {
|
||||||
|
if (this.authService.isOauth()) {
|
||||||
|
this.loadIdentityUserInfo();
|
||||||
|
this.mode = UserInfoMode.SSO;
|
||||||
|
|
||||||
|
if (this.authService.isECMProvider() && this.authService.isLoggedIn()) {
|
||||||
|
this.mode = UserInfoMode.CONTENT_SSO;
|
||||||
|
this.loadEcmUserInfo();
|
||||||
|
}
|
||||||
|
} else if (this.isAllLoggedIn()) {
|
||||||
|
this.loadEcmUserInfo();
|
||||||
|
this.loadBpmUserInfo();
|
||||||
|
this.mode = UserInfoMode.ALL;
|
||||||
|
} else if (this.isEcmLoggedIn()) {
|
||||||
|
this.loadEcmUserInfo();
|
||||||
|
this.mode = UserInfoMode.CONTENT;
|
||||||
|
} else if (this.isBpmLoggedIn()) {
|
||||||
|
this.loadBpmUserInfo();
|
||||||
|
this.mode = UserInfoMode.PROCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get isLoggedIn(): boolean {
|
||||||
|
if (this.basicAlfrescoAuthService.isKerberosEnabled()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return this.authService.isLoggedIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadEcmUserInfo(): void {
|
||||||
|
this.ecmUser$ = this.peopleContentService.getCurrentUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadBpmUserInfo() {
|
||||||
|
this.bpmUser$ = this.peopleProcessService.getCurrentUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadIdentityUserInfo() {
|
||||||
|
this.identityUser$ = of(this.identityUserService.getCurrentUserInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
private isAllLoggedIn() {
|
||||||
|
return (
|
||||||
|
(this.authService.isEcmLoggedIn() && this.authService.isBpmLoggedIn()) ||
|
||||||
|
(this.authService.isALLProvider() && this.basicAlfrescoAuthService.isKerberosEnabled())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private isBpmLoggedIn() {
|
||||||
|
return this.authService.isBpmLoggedIn() || (this.authService.isECMProvider() && this.basicAlfrescoAuthService.isKerberosEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
private isEcmLoggedIn() {
|
||||||
|
return this.authService.isEcmLoggedIn() || (this.authService.isECMProvider() && this.basicAlfrescoAuthService.isKerberosEnabled());
|
||||||
|
}
|
||||||
|
}
|
@@ -5,7 +5,7 @@ Status: Active
|
|||||||
Last reviewed: 2019-03-19
|
Last reviewed: 2019-03-19
|
||||||
---
|
---
|
||||||
|
|
||||||
# [Authentication Service](../../../lib/core/src/lib/auth/services/authentication.service.ts "Defined in authentication.service.ts")
|
# Authentication Service
|
||||||
|
|
||||||
Provides authentication to ACS and APS.
|
Provides authentication to ACS and APS.
|
||||||
|
|
||||||
@@ -19,15 +19,6 @@ Provides authentication to ACS and APS.
|
|||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<HttpHeaders>` - The new header with the token added
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<HttpHeaders>` - The new header with the token added
|
||||||
- **getBearerExcludedUrls**()<br/>
|
- **getBearerExcludedUrls**()<br/>
|
||||||
Gets the set of URLs that the token bearer is excluded from.
|
Gets the set of URLs that the token bearer is excluded from.
|
||||||
- **getBpmLoggedUser**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/UserRepresentation.md)`>`<br/>
|
|
||||||
Gets information about the user currently logged into APS.
|
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/UserRepresentation.md)`>` - User information
|
|
||||||
- **getBpmUsername**(): `string`<br/>
|
|
||||||
Gets the BPM username
|
|
||||||
- **Returns** `string` - The BPM username
|
|
||||||
- **getEcmUsername**(): `string`<br/>
|
|
||||||
Gets the ECM username.
|
|
||||||
- **Returns** `string` - The ECM username
|
|
||||||
- **getRedirect**(): `string`<br/>
|
- **getRedirect**(): `string`<br/>
|
||||||
Gets the URL to redirect to after login.
|
Gets the URL to redirect to after login.
|
||||||
- **Returns** `string` - The redirect URL
|
- **Returns** `string` - The redirect URL
|
||||||
@@ -43,43 +34,26 @@ Provides authentication to ACS and APS.
|
|||||||
- **getToken**(): `string`<br/>
|
- **getToken**(): `string`<br/>
|
||||||
Gets the auth token.
|
Gets the auth token.
|
||||||
- **Returns** `string` - Auth token string
|
- **Returns** `string` - Auth token string
|
||||||
- **handleError**(error: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
|
||||||
Prints an error message in the console browser
|
|
||||||
- _error:_ `any` - Error message
|
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Object representing the error message
|
|
||||||
- **isALLProvider**(): `boolean`<br/>
|
- **isALLProvider**(): `boolean`<br/>
|
||||||
Does the provider support both ECM and BPM?
|
Does the provider support both ECM and BPM?
|
||||||
- **Returns** `boolean` - True if both are supported, false otherwise
|
- **Returns** `boolean` - True if both are supported, false otherwise
|
||||||
- **isBPMProvider**(): `boolean`<br/>
|
- **isBPMProvider**(): `boolean`<br/>
|
||||||
Does the provider support BPM?
|
Does the provider support BPM?
|
||||||
- **Returns** `boolean` - True if supported, false otherwise
|
- **Returns** `boolean` - True if supported, false otherwise
|
||||||
- **isBpmLoggedIn**(): `boolean`<br/>
|
|
||||||
Checks if the user is logged in on a BPM provider.
|
|
||||||
- **Returns** `boolean` - True if logged in, false otherwise
|
|
||||||
- **isECMProvider**(): `boolean`<br/>
|
- **isECMProvider**(): `boolean`<br/>
|
||||||
Does the provider support ECM?
|
Does the provider support ECM?
|
||||||
- **Returns** `boolean` - True if supported, false otherwise
|
- **Returns** `boolean` - True if supported, false otherwise
|
||||||
- **isEcmLoggedIn**(): `boolean`<br/>
|
|
||||||
Checks if the user is logged in on an ECM provider.
|
|
||||||
- **Returns** `boolean` - True if logged in, false otherwise
|
|
||||||
- **isKerberosEnabled**(): `boolean`<br/>
|
- **isKerberosEnabled**(): `boolean`<br/>
|
||||||
Does kerberos enabled?
|
Does kerberos enabled?
|
||||||
- **Returns** `boolean` - True if enabled, false otherwise
|
- **Returns** `boolean` - True if enabled, false otherwise
|
||||||
- **isLoggedIn**(): `boolean`<br/>
|
- **isLoggedIn**(): `boolean`<br/>
|
||||||
Checks if the user logged in.
|
Checks if the user logged in.
|
||||||
- **Returns** `boolean` - True if logged in, false otherwise
|
- **Returns** `boolean` - True if logged in, false otherwise
|
||||||
- **isLoggedInWith**(provider: `string`): `boolean`<br/>
|
|
||||||
|
|
||||||
- _provider:_ `string` -
|
|
||||||
- **Returns** `boolean` -
|
|
||||||
|
|
||||||
- **isOauth**(): `boolean`<br/>
|
- **isOauth**(): `boolean`<br/>
|
||||||
Does the provider support OAuth?
|
Does the provider support OAuth?
|
||||||
- **Returns** `boolean` - True if supported, false otherwise
|
- **Returns** `boolean` - True if supported, false otherwise
|
||||||
- **isPublicUrl**(): `boolean`<br/>
|
- **isPublicUrl**(): `boolean`<br/>
|
||||||
|
- **Returns** `boolean` -
|
||||||
- **Returns** `boolean` -
|
|
||||||
|
|
||||||
- **isRememberMeSet**(): `boolean`<br/>
|
- **isRememberMeSet**(): `boolean`<br/>
|
||||||
Checks whether the "remember me" cookie was set or not.
|
Checks whether the "remember me" cookie was set or not.
|
||||||
- **Returns** `boolean` - True if set, false otherwise
|
- **Returns** `boolean` - True if set, false otherwise
|
||||||
@@ -89,11 +63,9 @@ Provides authentication to ACS and APS.
|
|||||||
- _password:_ `string` - Password for the login
|
- _password:_ `string` - Password for the login
|
||||||
- _rememberMe:_ `boolean` - Stores the user's login details if true
|
- _rememberMe:_ `boolean` - Stores the user's login details if true
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<Function>` - Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<Function>` - Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
|
||||||
- **logout**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
- **logout**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/> Logs the user out.
|
||||||
Logs the user out.
|
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Response event called when logout is complete
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Response event called when logout is complete
|
||||||
- **reset**()<br/>
|
- **reset**()<br/>
|
||||||
|
|
||||||
- **saveRememberMeCookie**(rememberMe: `boolean`)<br/>
|
- **saveRememberMeCookie**(rememberMe: `boolean`)<br/>
|
||||||
Saves the "remember me" cookie as either a long-life cookie or a session cookie.
|
Saves the "remember me" cookie as either a long-life cookie or a session cookie.
|
||||||
- _rememberMe:_ `boolean` - Enables a long-life cookie
|
- _rememberMe:_ `boolean` - Enables a long-life cookie
|
||||||
|
@@ -156,7 +156,7 @@ describe('ContentService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should take current logged user id if userId undefined ', () => {
|
it('should take current logged user id if userId undefined ', () => {
|
||||||
spyOn(authService, 'getEcmUsername').and.returnValue('user1');
|
spyOn(authService, 'getUsername').and.returnValue('user1');
|
||||||
const permissionNode = new Node({
|
const permissionNode = new Node({
|
||||||
permissions: {
|
permissions: {
|
||||||
inherited: [
|
inherited: [
|
||||||
|
@@ -84,7 +84,7 @@ export class ContentService {
|
|||||||
*/
|
*/
|
||||||
hasPermissions(node: Node, permission: PermissionsEnum | string, userId?: string): boolean {
|
hasPermissions(node: Node, permission: PermissionsEnum | string, userId?: string): boolean {
|
||||||
let hasPermissions = false;
|
let hasPermissions = false;
|
||||||
userId = userId ?? this.authService.getEcmUsername();
|
userId = userId ?? this.authService.getUsername();
|
||||||
|
|
||||||
const permissions = [...(node.permissions?.locallySet || []), ...(node.permissions?.inherited || [])].filter(
|
const permissions = [...(node.permissions?.locallySet || []), ...(node.permissions?.inherited || [])].filter(
|
||||||
(currentPermission) => currentPermission.authorityId === userId
|
(currentPermission) => currentPermission.authorityId === userId
|
||||||
|
@@ -274,7 +274,7 @@ describe('DropdownSitesComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show only sites which logged user is member of when member relation is set', async () => {
|
it('should show only sites which logged user is member of when member relation is set', async () => {
|
||||||
spyOn(authService, 'getEcmUsername').and.returnValue('test');
|
spyOn(authService, 'getUsername').and.returnValue('test');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ describe('DropdownSitesComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show all the sites if no relation is set', async () => {
|
it('should show all the sites if no relation is set', async () => {
|
||||||
spyOn(authService, 'getEcmUsername').and.returnValue('test');
|
spyOn(authService, 'getUsername').and.returnValue('test');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
@@ -182,7 +182,7 @@ export class DropdownSitesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private filteredResultsByMember(sites: SitePaging): SitePaging {
|
private filteredResultsByMember(sites: SitePaging): SitePaging {
|
||||||
const loggedUserName = this.authService.getEcmUsername();
|
const loggedUserName = this.authService.getUsername();
|
||||||
sites.list.entries = sites.list.entries.filter((site) => this.isCurrentUserMember(site, loggedUserName));
|
sites.list.entries = sites.list.entries.filter((site) => this.isCurrentUserMember(site, loggedUserName));
|
||||||
return sites;
|
return sites;
|
||||||
}
|
}
|
||||||
|
@@ -646,7 +646,7 @@ describe('DocumentList', () => {
|
|||||||
title: 'FileAction'
|
title: 'FileAction'
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('lockOwner');
|
spyOn(authenticationService, 'getUsername').and.returnValue('lockOwner');
|
||||||
|
|
||||||
documentList.actions = [documentMenu];
|
documentList.actions = [documentMenu];
|
||||||
|
|
||||||
@@ -677,7 +677,7 @@ describe('DocumentList', () => {
|
|||||||
title: 'FileAction'
|
title: 'FileAction'
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('jerryTheKillerCow');
|
spyOn(authenticationService, 'getUsername').and.returnValue('jerryTheKillerCow');
|
||||||
|
|
||||||
documentList.actions = [documentMenu];
|
documentList.actions = [documentMenu];
|
||||||
|
|
||||||
|
@@ -137,22 +137,22 @@ describe('LockService', () => {
|
|||||||
} as Node;
|
} as Node;
|
||||||
|
|
||||||
it('should return false when the user is the lock owner', () => {
|
it('should return false when the user is the lock owner', () => {
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('lock-owner-user');
|
spyOn(authenticationService, 'getUsername').and.returnValue('lock-owner-user');
|
||||||
expect(service.isLocked(nodeOwnerAllowedLock)).toBeFalsy();
|
expect(service.isLocked(nodeOwnerAllowedLock)).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true when the user is not the lock owner', () => {
|
it('should return true when the user is not the lock owner', () => {
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
|
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
|
||||||
expect(service.isLocked(nodeOwnerAllowedLock)).toBeTruthy();
|
expect(service.isLocked(nodeOwnerAllowedLock)).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false when the user is not the lock owner but the lock is expired', () => {
|
it('should return false when the user is not the lock owner but the lock is expired', () => {
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
|
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
|
||||||
expect(service.isLocked(nodeOwnerAllowedLockWithExpiredDate)).toBeFalsy();
|
expect(service.isLocked(nodeOwnerAllowedLockWithExpiredDate)).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true when is not the lock owner and the expiration date is valid', () => {
|
it('should return true when is not the lock owner and the expiration date is valid', () => {
|
||||||
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
|
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
|
||||||
expect(service.isLocked(nodeOwnerAllowedLockWithActiveExpiration)).toBeTruthy();
|
expect(service.isLocked(nodeOwnerAllowedLockWithActiveExpiration)).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -32,7 +32,7 @@ export class LockService {
|
|||||||
if (this.isReadOnlyLock(node)) {
|
if (this.isReadOnlyLock(node)) {
|
||||||
isLocked = !this.isLockExpired(node);
|
isLocked = !this.isLockExpired(node);
|
||||||
} else if (this.isLockOwnerAllowed(node)) {
|
} else if (this.isLockOwnerAllowed(node)) {
|
||||||
isLocked = this.authService.getEcmUsername() !== node.properties['cm:lockOwner'].id;
|
isLocked = this.authService.getUsername() !== node.properties['cm:lockOwner'].id;
|
||||||
if (this.isLockExpired(node)) {
|
if (this.isLockExpired(node)) {
|
||||||
isLocked = false;
|
isLocked = false;
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ export const AuthGuardBpm: CanActivateFn = async (_: ActivatedRouteSnapshot, sta
|
|||||||
return authGuardBaseService.redirectSSOSuccessURL();
|
return authGuardBaseService.redirectSSOSuccessURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authenticationService.isBpmLoggedIn() || authGuardBaseService.withCredentials) {
|
if (authenticationService.isLoggedIn() || authGuardBaseService.withCredentials) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,6 @@ import ee from 'event-emitter';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
export interface AuthenticationServiceInterface {
|
export interface AuthenticationServiceInterface {
|
||||||
|
|
||||||
onError: any;
|
onError: any;
|
||||||
onLogin: any;
|
onLogin: any;
|
||||||
onLogout: any;
|
onLogout: any;
|
||||||
@@ -31,30 +30,26 @@ export interface AuthenticationServiceInterface {
|
|||||||
emit: (type: string, ...args: any[]) => void;
|
emit: (type: string, ...args: any[]) => void;
|
||||||
|
|
||||||
getToken(): string;
|
getToken(): string;
|
||||||
|
|
||||||
isLoggedIn(): boolean;
|
isLoggedIn(): boolean;
|
||||||
|
|
||||||
isOauth(): boolean;
|
isOauth(): boolean;
|
||||||
|
|
||||||
logout(): any;
|
logout(): any;
|
||||||
|
|
||||||
isEcmLoggedIn(): boolean;
|
|
||||||
|
|
||||||
isBpmLoggedIn(): boolean;
|
|
||||||
|
|
||||||
isECMProvider(): boolean;
|
isECMProvider(): boolean;
|
||||||
|
|
||||||
isBPMProvider(): boolean;
|
isBPMProvider(): boolean;
|
||||||
|
|
||||||
isALLProvider(): boolean;
|
isALLProvider(): boolean;
|
||||||
|
getUsername(): string;
|
||||||
getEcmUsername(): string;
|
|
||||||
|
|
||||||
getBpmUsername(): string;
|
|
||||||
|
|
||||||
getAuthHeaders(requestUrl: string, header: HttpHeaders): HttpHeaders;
|
getAuthHeaders(requestUrl: string, header: HttpHeaders): HttpHeaders;
|
||||||
|
|
||||||
addTokenToHeader(requestUrl: string, headersArg?: HttpHeaders): Observable<HttpHeaders>;
|
addTokenToHeader(requestUrl: string, headersArg?: HttpHeaders): Observable<HttpHeaders>;
|
||||||
|
|
||||||
reset(): void;
|
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;
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,10 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
|
|||||||
map(([authenticated, isDiscoveryDocumentLoaded]) => !authenticated && isDiscoveryDocumentLoaded)
|
map(([authenticated, isDiscoveryDocumentLoaded]) => !authenticated && isDiscoveryDocumentLoaded)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `isLoggedIn` instead
|
||||||
|
* @returns true if the ECM provider is logged in
|
||||||
|
*/
|
||||||
isEcmLoggedIn(): boolean {
|
isEcmLoggedIn(): boolean {
|
||||||
if (this.isECMProvider() || this.isALLProvider()) {
|
if (this.isECMProvider() || this.isALLProvider()) {
|
||||||
return this.isLoggedIn();
|
return this.isLoggedIn();
|
||||||
@@ -63,6 +67,10 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `isLoggedIn` instead
|
||||||
|
* @returns true if the BPM provider is logged in
|
||||||
|
*/
|
||||||
isBpmLoggedIn(): boolean {
|
isBpmLoggedIn(): boolean {
|
||||||
if (this.isBPMProvider() || this.isALLProvider()) {
|
if (this.isBPMProvider() || this.isALLProvider()) {
|
||||||
return this.isLoggedIn();
|
return this.isLoggedIn();
|
||||||
|
@@ -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 {
|
isEcmLoggedIn(): boolean {
|
||||||
if (this.isOauth()) {
|
if (this.isOauth()) {
|
||||||
return this.oidcAuthenticationService.isEcmLoggedIn();
|
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 {
|
isBpmLoggedIn(): boolean {
|
||||||
if (this.isOauth()) {
|
if (this.isOauth()) {
|
||||||
return this.oidcAuthenticationService.isBpmLoggedIn();
|
return this.oidcAuthenticationService.isBpmLoggedIn();
|
||||||
@@ -166,11 +174,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
|
|||||||
* @returns the logged username
|
* @returns the logged username
|
||||||
*/
|
*/
|
||||||
getEcmUsername(): string {
|
getEcmUsername(): string {
|
||||||
if (this.isOauth()) {
|
return this.getUsername();
|
||||||
return this.oidcAuthenticationService.getUsername();
|
|
||||||
} else {
|
|
||||||
return this.basicAlfrescoAuthService.getEcmUsername();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,11 +182,7 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
|
|||||||
* @returns the logged username
|
* @returns the logged username
|
||||||
*/
|
*/
|
||||||
getBpmUsername(): string {
|
getBpmUsername(): string {
|
||||||
if (this.isOauth()) {
|
return this.getUsername();
|
||||||
return this.oidcAuthenticationService.getUsername();
|
|
||||||
} else {
|
|
||||||
return this.basicAlfrescoAuthService.getBpmUsername();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAuthHeaders(requestUrl: string, headers: HttpHeaders): HttpHeaders {
|
getAuthHeaders(requestUrl: string, headers: HttpHeaders): HttpHeaders {
|
||||||
|
@@ -51,7 +51,6 @@ export abstract class BaseAuthenticationService implements AuthenticationService
|
|||||||
abstract isBpmLoggedIn(): boolean;
|
abstract isBpmLoggedIn(): boolean;
|
||||||
|
|
||||||
abstract reset(): void;
|
abstract reset(): void;
|
||||||
|
|
||||||
abstract getUsername(): string;
|
abstract getUsername(): string;
|
||||||
|
|
||||||
/** @deprecated use `getUsername` instead */
|
/** @deprecated use `getUsername` instead */
|
||||||
|
Reference in New Issue
Block a user