Commit 57bb5831 authored by Diego Molteni's avatar Diego Molteni
Browse files

fix: 'master' into slb/dm3/fix-azure-auth-init

parent 82d691d0
Pipeline #79479 failed with stages
in 34 seconds
......@@ -237,7 +237,7 @@ The following software have components provided under the terms of this license:
- inflight (from https://www.npmjs.com/package/inflight)
- inherits (from https://www.npmjs.com/package/inherits)
- inherits (from https://www.npmjs.com/package/inherits)
- json-stringify-safe (from https://github.com/isaacs/json-stringify-safe)
- json-stringify-safe (from https://www.npmjs.com/package/json-stringify-safe)
- jwtproxy (from https://www.npmjs.com/package/jwtproxy)
- lockfile (from https://www.npmjs.com/package/lockfile)
- log-driver (from https://www.npmjs.com/package/log-driver)
......@@ -249,7 +249,7 @@ The following software have components provided under the terms of this license:
- nopt (from https://www.npmjs.com/package/nopt)
- npmlog (from https://www.npmjs.com/package/npmlog)
- npmlog (from https://www.npmjs.com/package/npmlog)
- once (from https://github.com/isaacs/once#readme)
- once (from https://www.npmjs.com/package/once)
- pseudomap (from https://www.npmjs.com/package/pseudomap)
- request-promise (from https://www.npmjs.com/package/request-promise)
- request-promise-core (from https://www.npmjs.com/package/request-promise-core)
......@@ -397,7 +397,7 @@ The following software have components provided under the terms of this license:
- chalk (from https://www.npmjs.com/package/chalk)
- chownr (from https://www.npmjs.com/package/chownr)
- cliui (from https://www.npmjs.com/package/cliui)
- code-point-at (from https://github.com/sindresorhus/code-point-at)
- code-point-at (from https://www.npmjs.com/package/code-point-at)
- color (from https://www.npmjs.com/package/color)
- color-convert (from https://www.npmjs.com/package/color-convert)
- color-convert (from https://www.npmjs.com/package/color-convert)
......@@ -560,7 +560,7 @@ The following software have components provided under the terms of this license:
- json-bigint (from https://www.npmjs.com/package/json-bigint)
- json-schema (from https://www.npmjs.com/package/json-schema)
- json-schema-traverse (from https://www.npmjs.com/package/json-schema-traverse)
- json-stringify-safe (from https://github.com/isaacs/json-stringify-safe)
- json-stringify-safe (from https://www.npmjs.com/package/json-stringify-safe)
- jsonfile (from https://www.npmjs.com/package/jsonfile)
- jsonwebtoken (from https://www.npmjs.com/package/jsonwebtoken)
- jsprim (from https://www.npmjs.com/package/jsprim)
......@@ -632,7 +632,7 @@ The following software have components provided under the terms of this license:
- object.assign (from https://www.npmjs.com/package/object.assign)
- object.getownpropertydescriptors (from https://www.npmjs.com/package/object.getownpropertydescriptors)
- on-finished (from https://www.npmjs.com/package/on-finished)
- once (from https://github.com/isaacs/once#readme)
- once (from https://www.npmjs.com/package/once)
- one-time (from https://www.npmjs.com/package/one-time)
- open (from https://www.npmjs.com/package/open)
- os-tmpdir (from https://www.npmjs.com/package/os-tmpdir)
......@@ -705,7 +705,7 @@ The following software have components provided under the terms of this license:
- split-on-first (from https://www.npmjs.com/package/split-on-first)
- sshpk (from https://www.npmjs.com/package/sshpk)
- stack-chain (from https://www.npmjs.com/package/stack-chain)
- stack-trace (from https://github.com/felixge/node-stack-trace)
- stack-trace (from https://www.npmjs.com/package/stack-trace)
- standard-as-callback (from https://www.npmjs.com/package/standard-as-callback)
- statuses (from https://www.npmjs.com/package/statuses)
- stealthy-require (from https://www.npmjs.com/package/stealthy-require)
......@@ -751,7 +751,7 @@ The following software have components provided under the terms of this license:
- url (from https://www.npmjs.com/package/url)
- url-join (from https://www.npmjs.com/package/url-join)
- urllib3 (from https://urllib3.readthedocs.io/)
- util-deprecate (from https://github.com/TooTallNate/util-deprecate)
- util-deprecate (from https://www.npmjs.com/package/util-deprecate)
- util.promisify (from https://www.npmjs.com/package/util.promisify)
- utils-merge (from https://www.npmjs.com/package/utils-merge)
- uuid (from https://www.npmjs.com/package/uuid)
......@@ -855,3 +855,5 @@ The following software have components provided under the terms of this license:
- protobufjs (from https://www.npmjs.com/package/protobufjs)
- querystring (from https://www.npmjs.com/package/querystring)
- sax (from https://www.npmjs.com/package/sax)
......@@ -60,7 +60,7 @@ export class AzureConfig extends Config {
AzureConfig.DES_SERVICE_HOST_STORAGE = process.env.DES_SERVICE_HOST;
AzureConfig.DES_SERVICE_HOST_PARTITION = process.env.DES_SERVICE_HOST;
AzureConfig.DES_ENTITLEMENT_DELETE_ENDPOINT_PATH = process.env.DES_ENTITLEMENT_DELETE_ENDPOINT_PATH;
AzureConfig.DES_SERVICE_APPKEY = 'undefined';
AzureConfig.DES_SERVICE_APPKEY = process.env.SEISTORE_DES_APPKEY || 'undefined';
AzureConfig.CCM_SERVICE_URL = process.env.CCM_SERVICE_URL;
AzureConfig.CCM_TOKEN_SCOPE = process.env.CCM_TOKEN_SCOPE;
Config.checkRequiredConfig(AzureConfig.DES_SERVICE_HOST_COMPLIANCE, 'DES_SERVICE_HOST');
......@@ -139,10 +139,9 @@ export class AzureConfig extends Config {
CCM_SERVICE_URL: AzureConfig.CCM_SERVICE_URL,
CCM_TOKEN_SCOPE: AzureConfig.CCM_TOKEN_SCOPE,
CALLER_FORWARD_HEADERS: process.env.CALLER_FORWARD_HEADERS,
USER_ID_CLAIM_FOR_SDMS: process.env.USER_ID_CLAIM_FOR_SDMS ? process.env.USER_ID_CLAIM_FOR_SDMS : 'subid',
USER_ID_CLAIM_FOR_ENTITLEMENTS_SVC: process.env.USER_ID_CLAIM_FOR_ENTITLEMENTS_SVC ?
process.env.USER_ID_CLAIM_FOR_ENTITLEMENTS_SVC : 'email',
USER_ASSOCIATION_SVC_PROVIDER: process.env.USER_ASSOCIATION_SVC_PROVIDER,
USER_ID_CLAIM_FOR_SDMS: process.env.USER_ID_CLAIM_FOR_SDMS || 'subid',
USER_ID_CLAIM_FOR_ENTITLEMENTS_SVC: process.env.USER_ID_CLAIM_FOR_ENTITLEMENTS_SVC || 'email',
USER_ASSOCIATION_SVC_PROVIDER: process.env.USER_ASSOCIATION_SVC_PROVIDER || 'ccm-internal',
SDMS_PREFIX: process.env.SDMS_PREFIX ? process.env.SDMS_PREFIX : '/seistore-svc/api/v3'
});
......
......@@ -17,6 +17,7 @@
export { DESCompliance } from './compliance';
export { DESEntitlement } from './entitlement';
export { DESStorage } from './storage';
export { UserAssociationServiceFactory } from './user-association';
export { DESUserAssociation } from './user-association-svc/ccm-internal';
export { DESUtils } from './utils';
......@@ -2,10 +2,10 @@ import request from 'request-promise';
import { AuthProviderFactory } from '../../auth';
import { Config, DataEcosystemCoreFactory } from '../../cloud';
import { Cache, Error } from '../../shared';
import { AbstractUserAssociationSvcProvider, UserAssocationServiceFactory } from '../user-association';
import { AbstractUserAssociationSvcProvider, UserAssociationServiceFactory } from '../user-association';
// this impl is used when the USER_ASSOCIATION_SVC_PROVIDER env variable is set to decorator identifier ccm-internal
@UserAssocationServiceFactory.register('ccm-internal')
@UserAssociationServiceFactory.register('ccm-internal')
export class DESUserAssociation extends AbstractUserAssociationSvcProvider {
private static _cache: Cache<string>;
......
......@@ -26,22 +26,22 @@ export abstract class AbstractUserAssociationSvcProvider implements IUserAssocia
}
export class UserAssociationFactoryBuilder {
public static register(identifer: string) {
public static register(identifier: string) {
return (target: any) => {
if (UserAssociationFactoryBuilder.providers[identifer]) {
UserAssociationFactoryBuilder.providers[identifer].push(target);
if (UserAssociationFactoryBuilder.providers[identifier]) {
UserAssociationFactoryBuilder.providers[identifier].push(target);
} else {
UserAssociationFactoryBuilder.providers[identifer] = [target];
UserAssociationFactoryBuilder.providers[identifier] = [target];
}
};
}
public static build(identifer: string, referenceAbstraction: any, args: { [key: string]: any; } = {}) {
if (identifer === undefined || identifer === 'unknown') {
public static build(identifier: string, referenceAbstraction: any, args: { [key: string]: any; } = {}) {
if (identifier === undefined || identifier === 'unknown') {
throw (Error.make(Error.Status.UNKNOWN,
`Unrecognized user assocation service provider: ${identifer}`));
`Unrecognized user association service provider: ${identifier}`));
}
for (const provider of UserAssociationFactoryBuilder.providers[identifer]) {
for (const provider of UserAssociationFactoryBuilder.providers[identifier]) {
if (provider.prototype instanceof referenceAbstraction) {
return new provider(args);
}
......@@ -54,7 +54,7 @@ export class UserAssociationFactoryBuilder {
}
export class UserAssocationServiceFactory extends UserAssociationFactoryBuilder {
export class UserAssociationServiceFactory extends UserAssociationFactoryBuilder {
public static build(identifier: string): AbstractUserAssociationSvcProvider {
return UserAssociationFactoryBuilder.build(identifier, AbstractUserAssociationSvcProvider);
}
......
......@@ -19,8 +19,7 @@ import { v4 as uuidv4 } from 'uuid';
import { DatasetModel } from '.';
import { Auth, AuthRoles } from '../../auth';
import { Config, JournalFactoryTenantClient, LoggerFactory, StorageFactory } from '../../cloud';
import { DESStorage, DESUtils } from '../../dataecosystem';
import { UserAssocationServiceFactory } from '../../dataecosystem/user-association';
import { DESStorage, DESUtils, UserAssociationServiceFactory } from '../../dataecosystem';
import { Error, Feature, FeatureFlags, Params, Response, Utils } from '../../shared';
import { SubprojectAuth, SubProjectDAO, SubProjectModel } from '../subproject';
import { TenantDAO, TenantModel } from '../tenant';
......@@ -325,7 +324,7 @@ export class DatasetHandler {
if (FeatureFlags.isEnabled(Feature.CCM_INTERACTION) && convertSubIdToEmail) {
if (!Utils.isEmail(datasetOUT.created_by)) {
const dataPartition = DESUtils.getDataPartitionID(tenant.esd);
const userEmail = await UserAssocationServiceFactory.build(Config.USER_ASSOCIATION_SVC_PROVIDER).
const userEmail = await UserAssociationServiceFactory.build(Config.USER_ASSOCIATION_SVC_PROVIDER).
convertPrincipalIdentifierToEmail(datasetOUT.created_by, dataPartition);
datasetOUT.created_by = userEmail;
}
......
......@@ -21,7 +21,7 @@ import { Auth, AuthGroups, AuthRoles, UserRoles } from '../../auth';
import { Config, JournalFactoryTenantClient, LoggerFactory, StorageFactory } from '../../cloud';
import { SeistoreFactory } from '../../cloud/seistore';
import { DESUtils } from '../../dataecosystem';
import { UserAssocationServiceFactory } from '../../dataecosystem/user-association';
import { UserAssociationServiceFactory } from '../../dataecosystem';
import { Error, Feature, FeatureFlags, Response, Utils } from '../../shared';
import { DatasetDAO, PaginationModel } from '../dataset';
import { TenantAuth, TenantModel } from '../tenant';
......@@ -212,7 +212,7 @@ export class SubProjectHandler {
if (FeatureFlags.isEnabled(Feature.CCM_INTERACTION) && convertSubIdToEmail) {
if (!Utils.isEmail(subproject.admin)) {
const dataPartition = DESUtils.getDataPartitionID(tenant.esd);
subproject.admin = await UserAssocationServiceFactory.build(Config.USER_ASSOCIATION_SVC_PROVIDER)
subproject.admin = await UserAssociationServiceFactory.build(Config.USER_ASSOCIATION_SVC_PROVIDER)
.convertPrincipalIdentifierToEmail(subproject.admin, dataPartition);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment