mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ADF-3885]Change auth host path in cloud e2e tests (#4123)
This commit is contained in:
committed by
Eugenio Romano
parent
a19d2c99be
commit
968c65ff70
@@ -21,12 +21,16 @@ import TestConfig = require('../../test.config');
|
||||
export class ApiService {
|
||||
|
||||
HOST_SSO = TestConfig.adf.hostSso;
|
||||
HOST_BPM = TestConfig.adf.hostBPM;
|
||||
HOST_IDENTITY = TestConfig.adf.hostIdentity;
|
||||
|
||||
apiService = new AlfrescoApi({
|
||||
provider: 'BPM',
|
||||
bpmHost: `${this.HOST_BPM}`,
|
||||
identityHost: `${this.HOST_IDENTITY}`,
|
||||
authType: 'OAUTH',
|
||||
oauth2: {
|
||||
host: `${this.HOST_SSO}/auth/realms/springboot`,
|
||||
host: `${this.HOST_SSO}`,
|
||||
authType: '/protocol/openid-connect/token',
|
||||
clientId: 'activiti',
|
||||
scope: 'openid',
|
||||
@@ -44,7 +48,25 @@ export class ApiService {
|
||||
}
|
||||
|
||||
async performBpmOperation(path, method, queryParams, postBody) {
|
||||
const uri = this.HOST_SSO + path;
|
||||
const uri = this.HOST_BPM + path;
|
||||
const pathParams = {}, formParams = {};
|
||||
const authNames = [];
|
||||
const contentTypes = ['application/json'];
|
||||
const accepts = ['application/json'];
|
||||
|
||||
const headerParams = {
|
||||
'Authorization': 'bearer ' + this.apiService.oauth2Auth.token
|
||||
};
|
||||
|
||||
return this.apiService.bpmClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, {})
|
||||
.catch((error) => {
|
||||
throw (error);
|
||||
});
|
||||
}
|
||||
|
||||
async performIdentityOperation(path, method, queryParams, postBody) {
|
||||
const uri = this.HOST_IDENTITY + path;
|
||||
const pathParams = {}, formParams = {};
|
||||
const authNames = [];
|
||||
const contentTypes = ['application/json'];
|
||||
|
||||
@@ -42,7 +42,7 @@ export class Identity {
|
||||
}
|
||||
|
||||
async createUser(username) {
|
||||
const path = '/auth/admin/realms/springboot/users';
|
||||
const path = '/users';
|
||||
const method = 'POST';
|
||||
const queryParams = {}, postBody = {
|
||||
'username': username,
|
||||
@@ -51,55 +51,55 @@ export class Identity {
|
||||
'enabled': true,
|
||||
'email': username + '@alfresco.com'
|
||||
};
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
async deleteUser(userId) {
|
||||
const path = `/auth/admin/realms/springboot/users/${userId}`;
|
||||
const path = `/users/${userId}`;
|
||||
const method = 'DELETE';
|
||||
const queryParams = {}, postBody = {
|
||||
};
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
async getUserInfoByUsername(username) {
|
||||
const path = `/auth/admin/realms/springboot/users`;
|
||||
const path = `/users`;
|
||||
const method = 'GET';
|
||||
const queryParams = { 'username' : username }, postBody = {};
|
||||
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
async resetPassword(id, password) {
|
||||
const path = `/auth/admin/realms/springboot/users/${id}/reset-password`;
|
||||
const path = `/users/${id}/reset-password`;
|
||||
const method = 'PUT';
|
||||
const queryParams = {},
|
||||
postBody = {'type': 'password', 'value': password, 'temporary': false};
|
||||
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
async getRoleByName(roleName) {
|
||||
const path = `/auth/admin/realms/springboot/roles/${roleName}`;
|
||||
const path = `/roles/${roleName}`;
|
||||
const method = 'GET';
|
||||
const queryParams = {},
|
||||
postBody = {};
|
||||
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
async assignRole(userId, roleId, roleName) {
|
||||
const path = `/auth/admin/realms/springboot/users/${userId}/role-mappings/realm`;
|
||||
const path = `/users/${userId}/role-mappings/realm`;
|
||||
const method = 'POST';
|
||||
const queryParams = {},
|
||||
postBody = [{'id': roleId, 'name': roleName}];
|
||||
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user