This commit is contained in:
eromano
2023-06-22 17:49:09 +02:00
parent ccde807f0e
commit f9a378b7f9
15 changed files with 64 additions and 76 deletions

View File

@@ -139,7 +139,8 @@
"webscript",
"Whitespaces",
"xdescribe",
"xsrf"
"xsrf",
"BPMECM"
],
"dictionaries": [
"html",

View File

@@ -43,8 +43,7 @@ import { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-e
import { Constructor } from './types';
import { RequestOptions, SecurityOptions } from './interfaces';
import { AppConfigService, AppConfigValues } from '../../../src/lib/app-config/app-config.service';
import ee from 'event-emitter';
import { Emitter } from 'event-emitter';
import ee, { Emitter } from 'event-emitter';
export interface Emitters {
readonly eventEmitter: Emitter;

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.
@@ -19,8 +19,8 @@ import { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
import { Authentication } from '../interfaces/authentication.interface';
import { CookieService } from '../../common/services/cookie.service';
import { ContentAuth } from './contentAuth';
import { ProcessAuth } from './processAuth';
import { ContentAuth } from './content-auth';
import { ProcessAuth } from './process-auth';
import { map } from 'rxjs/operators';
import { from, Observable } from 'rxjs';
import { RedirectionModel } from '../models/redirection.model';
@@ -40,9 +40,9 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
authentications: Authentication = {
basicAuth: {
ticket: '',
ticket: ''
},
type: 'basic',
type: 'basic'
};
constructor(
@@ -55,22 +55,22 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
super(appConfig, cookie, logService);
this.contentAuth.onLogout.pipe(map((event) => {
this.onLogout.next(event)
this.onLogout.next(event);
}));
this.contentAuth.onLogin.pipe(map((event) => {
this.onLogout.next(event)
this.onLogout.next(event);
}));
this.contentAuth.onError.pipe(map((event) => {
this.onLogout.next(event)
this.onLogout.next(event);
}));
this.processAuth.onLogout.pipe(map((event) => {
this.onLogout.next(event)
this.onLogout.next(event);
}));
this.processAuth.onLogin.pipe(map((event) => {
this.onLogin.next(event)
this.onLogin.next(event);
}));
this.processAuth.onError.pipe(map((event) => {
this.onError.next(event)
this.onError.next(event);
}));
}
@@ -100,7 +100,7 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
* @param username: // Username to login
* @param password: // Password to login
*
* @returns {Promise} A promise that returns {new authentication ticket} if resolved and {error} if rejected.
* @returns A promise that returns {new authentication ticket} if resolved and {error} if rejected.
* */
async executeLogin(username: string, password: string): Promise<any> {
if (!this.isCredentialValid(username) || !this.isCredentialValid(password)) {
@@ -115,14 +115,12 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
try {
return await this.processAuth.login(username, password);
} catch (e) {
console.log('login BPM error');
}
} else if (this.isECMProvider()) {
try {
return await this.contentAuth.login(username, password);
} catch (e) {
console.log('login BPM error');
}
} else if (this.isALLProvider()) {
@@ -187,7 +185,7 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
}
getToken(): string {
return "";
return '';
}
isBpmLoggedIn(): boolean {

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2018 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.
@@ -52,9 +52,9 @@ export class ContentAuth {
authentications: Authentication = {
basicAuth: {
ticket: '',
ticket: ''
},
type: 'basic',
type: 'basic'
};
get basePath(): string {
@@ -126,7 +126,7 @@ export class ContentAuth {
/**
* logout Alfresco API
*
* @returns {Promise} A promise that returns { authentication ticket} if resolved and {error} if rejected.
* @returns A promise that returns { authentication ticket} if resolved and {error} if rejected.
* */
logout(): Promise<any> {
this.saveUsername('');
@@ -204,16 +204,6 @@ export class ContentAuth {
return this.adfHttpClient.post(this.basePath + '/tickets', {bodyParam: ticketBodyCreate});
}
/**
* Delete ticket (logout)
*
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Deletes logged in ticket (logout).
*
* @return Promise<{}>
*/
deleteTicket(): Promise<any> {
return this.adfHttpClient.delete(this.basePath + '/tickets/-me-');
}

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2018 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { AdfHttpClient } from '@alfresco/adf-core/api';
import { Authentication } from '../interfaces/authentication.interface';
@@ -87,7 +88,7 @@ export class ProcessAuth {
submit: 'Login'
},
contentType: 'application/x-www-form-urlencoded',
accept: 'application/json',
accept: 'application/json'
};
let promise: any = new Promise((resolve, reject) => {
@@ -122,8 +123,7 @@ export class ProcessAuth {
/**
* logout Alfresco API
*
* @returns {Promise} A promise that returns {new authentication ticket} if resolved and {error} if rejected.
* @returns A promise that returns {new authentication ticket} if resolved and {error} if rejected.
* */
async logout(): Promise<any> {
this.saveUsername('');

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -24,7 +24,7 @@ import { CoreTestingModule } from '../../testing/core.testing.module';
import { MatDialog } from '@angular/material/dialog';
import { TranslateModule } from '@ngx-translate/core';
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
import { OidcAuthenticationService } from '../services/oidc-authentication.service'
import { OidcAuthenticationService } from '../services/oidc-authentication.service';
describe('AuthGuardService BPM', () => {

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.
@@ -124,7 +124,7 @@ export abstract class BaseAuthenticationService implements AuthenticationServic
* @returns Object representing the error message
*/
handleError(error: any): Observable<any> {
this.onError.next(error || 'Server error')
this.onError.next(error || 'Server error');
this.logService.error('Error when logging in', error);
return throwError(error || 'Server error');
}

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* Copyright © 2005-2023 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.
@@ -43,7 +43,7 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
private authStorage: OAuthStorage,
private oauthService: OAuthService,
private readonly authConfig: AuthConfigService,
private readonly auth: AuthService,
private readonly auth: AuthService
) {
super(appConfig, cookie, logService);
}