@platform-mesh/portal-server-lib 0.6.18 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/portal-options/auth-config-provider.js +7 -10
- package/dist/portal-options/auth-config-provider.js.map +1 -1
- package/dist/portal-options/models/k8s.d.ts +1 -1
- package/dist/portal-options/service-providers/content-configuration-service-providers.service.js +1 -4
- package/dist/portal-options/service-providers/content-configuration-service-providers.service.js.map +1 -1
- package/dist/portal-options/service-providers/kubernetes-service-providers.service.js +3 -8
- package/dist/portal-options/service-providers/kubernetes-service-providers.service.js.map +1 -1
- package/dist/portal-options/services/kcp-k8s.service.d.ts +3 -4
- package/dist/portal-options/services/kcp-k8s.service.js +5 -21
- package/dist/portal-options/services/kcp-k8s.service.js.map +1 -1
- package/dist/portal-options/utils/account-hierarchy-resolver.d.ts +1 -1
- package/dist/portal-options/utils/account-hierarchy-resolver.js +10 -4
- package/dist/portal-options/utils/account-hierarchy-resolver.js.map +1 -1
- package/package.json +2 -2
- package/src/portal-options/auth-config-provider.spec.ts +28 -6
- package/src/portal-options/auth-config-provider.ts +11 -18
- package/src/portal-options/models/k8s.ts +1 -1
- package/src/portal-options/service-providers/content-configuration-service-providers.service.ts +4 -8
- package/src/portal-options/service-providers/kubernetes-service-providers.service.spec.ts +0 -62
- package/src/portal-options/service-providers/kubernetes-service-providers.service.ts +4 -12
- package/src/portal-options/services/kcp-k8s.service.spec.ts +5 -6
- package/src/portal-options/services/kcp-k8s.service.ts +10 -24
- package/src/portal-options/utils/account-hierarchy-resolver.spec.ts +12 -16
- package/src/portal-options/utils/account-hierarchy-resolver.ts +12 -5
|
@@ -21,10 +21,8 @@ let PMAuthConfigProvider = class PMAuthConfigProvider {
|
|
|
21
21
|
async getAuthConfig(request) {
|
|
22
22
|
const oidcUrl = getDiscoveryEndpoint(request);
|
|
23
23
|
const org = getOrganization(request);
|
|
24
|
-
const clientId = await this.readClientId(org);
|
|
25
|
-
const clientSecret =
|
|
26
|
-
? await this.kcpKubernetesService.getClientSecret(org, `portal-client-secret-${org}`)
|
|
27
|
-
: await this.kcpKubernetesService.getClientSecret(org);
|
|
24
|
+
const { clientId, secretRefName } = await this.readClientId(org);
|
|
25
|
+
const clientSecret = await this.kcpKubernetesService.getClientSecret(secretRefName);
|
|
28
26
|
const baseDomain = process.env['BASE_DOMAINS_DEFAULT'];
|
|
29
27
|
const oidc = await this.discoveryService.getOIDC(oidcUrl);
|
|
30
28
|
const oauthServerUrl = oidc?.authorization_endpoint ?? process.env['AUTH_SERVER_URL_DEFAULT'];
|
|
@@ -55,14 +53,13 @@ let PMAuthConfigProvider = class PMAuthConfigProvider {
|
|
|
55
53
|
plural: 'identityproviderconfigurations',
|
|
56
54
|
name: orgName,
|
|
57
55
|
};
|
|
58
|
-
if (orgName === 'welcome') {
|
|
59
|
-
const result = await this.kcpKubernetesService.getClusterCustomObjectByWorkspacePath(k8sResourceDescriptor, 'root:platform-mesh-system');
|
|
60
|
-
return result.status.managedClients[orgName].clientId;
|
|
61
|
-
}
|
|
62
56
|
const result = await this.kcpKubernetesService.listClusterCustomObject(k8sResourceDescriptor, {
|
|
63
57
|
organization: orgName,
|
|
64
|
-
});
|
|
65
|
-
return
|
|
58
|
+
}, orgName === 'welcome' ? 'root:platform-mesh-system' : undefined);
|
|
59
|
+
return {
|
|
60
|
+
clientId: result.status.managedClients[orgName].clientId,
|
|
61
|
+
secretRefName: result.status.managedClients[orgName].secretRef.name,
|
|
62
|
+
};
|
|
66
63
|
}
|
|
67
64
|
};
|
|
68
65
|
PMAuthConfigProvider = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-config-provider.js","sourceRoot":"","sources":["../../src/portal-options/auth-config-provider.ts"],"names":[],"mappings":";;;;;;;;;AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,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,IAAI,EAAE,OAAO;SACd,CAAC;QAEF,MAAM,MAAM,GACV,MAAM,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CACrD,qBAAqB,EACrB;YACE,YAAY,EAAE,OAAO;SACtB,EACD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAChE,CAAC;QAEJ,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ;YACxD,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,IAAI;SACpE,CAAC;IACJ,CAAC;CACF,CAAA;AAvEY,oBAAoB;IADhC,UAAU,EAAE;qCAGiB,gBAAgB;QACZ,oBAAoB;GAHzC,oBAAoB,CAuEhC"}
|
package/dist/portal-options/service-providers/content-configuration-service-providers.service.js
CHANGED
|
@@ -48,10 +48,7 @@ let ContentConfigurationServiceProvidersService = class ContentConfigurationServ
|
|
|
48
48
|
if (!contentConfiguration.url) {
|
|
49
49
|
contentConfiguration.url = item.spec.remoteConfiguration?.url;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
if (accountPath) {
|
|
53
|
-
processContentConfigurationForAccountHierarchy(contentConfiguration, accountPath);
|
|
54
|
-
}
|
|
51
|
+
processContentConfigurationForAccountHierarchy(contentConfiguration, context);
|
|
55
52
|
return contentConfiguration;
|
|
56
53
|
}
|
|
57
54
|
catch (parseError) {
|
package/dist/portal-options/service-providers/content-configuration-service-providers.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-configuration-service-providers.service.js","sourceRoot":"","sources":["../../../src/portal-options/service-providers/content-configuration-service-providers.service.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,8CAA8C,EAAE,MAAM,wCAAwC,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AA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,EAAE,CAAC;gBACpE,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACpE,MAAM,qBAAqB,GACzB,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK;iBAC9D,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,4BAA4B,CAAC,KAAK,MAAM,CAClE;iBACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,IAAI,CAAC;oBAEH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC;wBACtC,MAAM,IAAI,KAAK,CACb,yCAAyC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,CAC5E,CAAC;oBACJ,CAAC;oBAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CACrC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CACR,CAAC;oBAE1B,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC;wBAC9B,oBAAoB,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,CAAC;oBAChE,CAAC;oBAED,
|
|
1
|
+
{"version":3,"file":"content-configuration-service-providers.service.js","sourceRoot":"","sources":["../../../src/portal-options/service-providers/content-configuration-service-providers.service.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,8CAA8C,EAAE,MAAM,wCAAwC,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,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ACb,iDAAiD,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,CACpF,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;YAEP,OAAO;gBACL,mBAAmB,EAAE;oBACnB;wBACE,IAAI,EAAE,sBAAsB;wBAC5B,WAAW,EAAE,EAAE;wBACf,iBAAiB,EAAE,EAAE;wBACrB,oBAAoB,EAAE,qBAAqB;qBAC5C;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,IACE,KAAK,YAAY,KAAK;gBACtB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAC7C,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,KAAK,CACb,2CAA2C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACtG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AA3HY,2CAA2C;IADvD,UAAU,EAAE;GACA,2CAA2C,CA2HvD"}
|
|
@@ -26,7 +26,7 @@ let KubernetesServiceProvidersService = class KubernetesServiceProvidersService
|
|
|
26
26
|
if (!context?.organization) {
|
|
27
27
|
throw new Error('Context with organization is required');
|
|
28
28
|
}
|
|
29
|
-
const response = await this.listContentConfigurationsForEntity(token,
|
|
29
|
+
const response = await this.listContentConfigurationsForEntity(token, context);
|
|
30
30
|
if (!response.items) {
|
|
31
31
|
return {
|
|
32
32
|
rawServiceProviders: [],
|
|
@@ -40,10 +40,7 @@ let KubernetesServiceProvidersService = class KubernetesServiceProvidersService
|
|
|
40
40
|
if (!contentConfiguration.url) {
|
|
41
41
|
contentConfiguration.url = item.spec.remoteConfiguration?.url;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
if (accountPath) {
|
|
45
|
-
processContentConfigurationForAccountHierarchy(contentConfiguration, accountPath);
|
|
46
|
-
}
|
|
43
|
+
processContentConfigurationForAccountHierarchy(contentConfiguration, context);
|
|
47
44
|
return contentConfiguration;
|
|
48
45
|
});
|
|
49
46
|
return {
|
|
@@ -57,13 +54,11 @@ let KubernetesServiceProvidersService = class KubernetesServiceProvidersService
|
|
|
57
54
|
],
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
|
-
async listContentConfigurationsForEntity(token,
|
|
61
|
-
const entity = !entities || !entities.length ? 'main' : entities[0];
|
|
57
|
+
async listContentConfigurationsForEntity(token, context) {
|
|
62
58
|
const gvr = {
|
|
63
59
|
group: 'ui.platform-mesh.io',
|
|
64
60
|
version: 'v1alpha1',
|
|
65
61
|
plural: 'contentconfigurations',
|
|
66
|
-
labelSelector: `ui.platform-mesh.io/entity=${entity}`,
|
|
67
62
|
};
|
|
68
63
|
try {
|
|
69
64
|
return await this.kcpKubernetesService.listClusterCustomObjectInKcpVirtualWorkspace(gvr, context, token);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kubernetes-service-providers.service.js","sourceRoot":"","sources":["../../../src/portal-options/service-providers/kubernetes-service-providers.service.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,8CAA8C,EAAE,MAAM,wCAAwC,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQrC,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IACxB;IAApB,YAAoB,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAElE,KAAK,CAAC,mBAAmB,CACvB,KAAa,EACb,QAAkB,EAClB,OAA4B;QAG5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kCAAkC,CAC5D,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"kubernetes-service-providers.service.js","sourceRoot":"","sources":["../../../src/portal-options/service-providers/kubernetes-service-providers.service.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,8CAA8C,EAAE,MAAM,wCAAwC,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQrC,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IACxB;IAApB,YAAoB,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAElE,KAAK,CAAC,mBAAmB,CACvB,KAAa,EACb,QAAkB,EAClB,OAA4B;QAG5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kCAAkC,CAC5D,KAAK,EACL,OAA4B,CAC7B,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO;gBACL,mBAAmB,EAAE,EAAE;aACxB,CAAC;QACJ,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M,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAC1D,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;gBAClE,OAAO,MAAM,IAAI,CAAC,oBAAoB,CAAC,4CAA4C,CACjF,GAAG,EACH,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AAhGY,iCAAiC;IAD7C,UAAU,EAAE;qCAE+B,oBAAoB;GADnD,iCAAiC,CAgG7C"}
|
|
@@ -17,11 +17,10 @@ export declare class KcpKubernetesService {
|
|
|
17
17
|
getKcpK8sCoreV1Api(): CoreV1Api;
|
|
18
18
|
private buildWorkspacePath;
|
|
19
19
|
getKcpVirtualWorkspaceUrl(organization: string, account: string): URL;
|
|
20
|
-
getKcpWorkspaceUrl(organization?: string, account?: string): URL;
|
|
20
|
+
getKcpWorkspaceUrl(organization?: string, account?: string, workspacePath?: string): URL;
|
|
21
21
|
getKcpWorkspacePublicUrl(request: Request): string;
|
|
22
22
|
private getAppPort;
|
|
23
|
-
listClusterCustomObject(gvr: K8sResourceDescriptor, requestContext: K8sRequestContext): Promise<any>;
|
|
24
|
-
getClusterCustomObjectByWorkspacePath(gvr: K8sResourceDescriptor, workspacePath: string): Promise<any>;
|
|
23
|
+
listClusterCustomObject(gvr: K8sResourceDescriptor, requestContext: K8sRequestContext, workspacePath?: string): Promise<any>;
|
|
25
24
|
listClusterCustomObjectInKcpVirtualWorkspace(gvr: K8sResourceDescriptor, requestContext: K8sRequestContext, token: string): Promise<any>;
|
|
26
|
-
getClientSecret(
|
|
25
|
+
getClientSecret(secretName: string): Promise<string>;
|
|
27
26
|
}
|
|
@@ -72,8 +72,8 @@ let KcpKubernetesService = KcpKubernetesService_1 = class KcpKubernetesService {
|
|
|
72
72
|
const path = this.buildWorkspacePath(organization, account);
|
|
73
73
|
return new URL(`${this.baseUrl.origin}/services/contentconfigurations/clusters/${path}`);
|
|
74
74
|
}
|
|
75
|
-
getKcpWorkspaceUrl(organization, account) {
|
|
76
|
-
const path = this.buildWorkspacePath(organization, account);
|
|
75
|
+
getKcpWorkspaceUrl(organization, account, workspacePath) {
|
|
76
|
+
const path = workspacePath || this.buildWorkspacePath(organization, account);
|
|
77
77
|
return new URL(`${this.baseUrl.origin}/clusters/${path}`);
|
|
78
78
|
}
|
|
79
79
|
getKcpWorkspacePublicUrl(request) {
|
|
@@ -98,14 +98,14 @@ let KcpKubernetesService = KcpKubernetesService_1 = class KcpKubernetesService {
|
|
|
98
98
|
const isStandardOrEmptyPort = portFromRequest === '80' || portFromRequest === '443' || !portFromRequest;
|
|
99
99
|
return isStandardOrEmptyPort ? '' : `:${portFromRequest}`;
|
|
100
100
|
}
|
|
101
|
-
async listClusterCustomObject(gvr, requestContext) {
|
|
101
|
+
async listClusterCustomObject(gvr, requestContext, workspacePath) {
|
|
102
102
|
return await this.k8sCustomObjectsApi.listClusterCustomObject(gvr, {
|
|
103
103
|
middleware: [
|
|
104
104
|
new PromiseMiddlewareWrapper({
|
|
105
105
|
pre: async (context) => {
|
|
106
106
|
const accountPath = requestContext?.accountPath ??
|
|
107
107
|
requestContext?.['core_platform-mesh_io_account'];
|
|
108
|
-
const kcpUrl = this.getKcpWorkspaceUrl(requestContext.organization, accountPath);
|
|
108
|
+
const kcpUrl = this.getKcpWorkspaceUrl(requestContext.organization, accountPath, workspacePath);
|
|
109
109
|
const path = `${kcpUrl}/apis/${gvr.group}/${gvr.version}/${gvr.plural}/${gvr.name}`;
|
|
110
110
|
this.logger.log(`kcp url: ${path}`);
|
|
111
111
|
context.setUrl(path);
|
|
@@ -116,21 +116,6 @@ let KcpKubernetesService = KcpKubernetesService_1 = class KcpKubernetesService {
|
|
|
116
116
|
],
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
async getClusterCustomObjectByWorkspacePath(gvr, workspacePath) {
|
|
120
|
-
return await this.k8sCustomObjectsApi.listClusterCustomObject(gvr, {
|
|
121
|
-
middleware: [
|
|
122
|
-
new PromiseMiddlewareWrapper({
|
|
123
|
-
pre: async (context) => {
|
|
124
|
-
const path = `${this.baseUrl.origin}/clusters/${workspacePath}/apis/${gvr.group}/${gvr.version}/${gvr.plural}/${gvr.name}`;
|
|
125
|
-
this.logger.log(`kcp url: ${path}`);
|
|
126
|
-
context.setUrl(path);
|
|
127
|
-
return context;
|
|
128
|
-
},
|
|
129
|
-
post: async (context) => context,
|
|
130
|
-
}),
|
|
131
|
-
],
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
119
|
async listClusterCustomObjectInKcpVirtualWorkspace(gvr, requestContext, token) {
|
|
135
120
|
return await this.k8sCustomObjectsApiOIDCUser.listClusterCustomObject(gvr, {
|
|
136
121
|
middleware: [
|
|
@@ -150,8 +135,7 @@ let KcpKubernetesService = KcpKubernetesService_1 = class KcpKubernetesService {
|
|
|
150
135
|
],
|
|
151
136
|
});
|
|
152
137
|
}
|
|
153
|
-
async getClientSecret(
|
|
154
|
-
const secretName = secretNameOverride ?? `portal-client-secret-${orgName}-${orgName}`;
|
|
138
|
+
async getClientSecret(secretName) {
|
|
155
139
|
const namespace = 'default';
|
|
156
140
|
try {
|
|
157
141
|
const res = await this.k8sCoreV1Api.readNamespacedSecret({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kcp-k8s.service.js","sourceRoot":"","sources":["../../../src/portal-options/services/kcp-k8s.service.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,IAAM,oBAAoB,4BAA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U,EAAE,CAAC;QAC5B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;IAED,iCAAiC;QAC/B,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC1C,CAAC;IAED,yBAAyB;QACvB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAEO,kBAAkB,CAAC,YAAqB,EAAE,OAAgB;QAChE,IAAI,IAAI,GAAG,WAAW,CAAC;QACvB,IAAI,YAAY,EAAE,CAAC;YACjB,IAAI,IAAI,IAAI,YAAY,EAAE,CAAC;QAC7B,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yBAAyB,CAAC,YAAoB,EAAE,OAAe;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO,IAAI,GAAG,CACZ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,4CAA4C,IAAI,EAAE,CACzE,CAAC;IACJ,CAAC;IAED,kBAAkB,
|
|
1
|
+
{"version":3,"file":"kcp-k8s.service.js","sourceRoot":"","sources":["../../../src/portal-options/services/kcp-k8s.service.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7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AQ,CAChE,OAAO,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,4BAA4B,EAC5B,UAAU,EACV,GAAG,CAAC,QAAQ,EAAE,IAAI,IAAI,GAAG,CAC1B,CAAC;YACF,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAA;AAjNY,oBAAoB;IADhC,UAAU,EAAE;;GACA,oBAAoB,CAiNhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ContentConfiguration } from '@openmfp/portal-server-lib';
|
|
2
2
|
export declare const updateEntityTypeFromAccountPath: (contentConfiguration: ContentConfiguration, accountPath: string) => ContentConfiguration;
|
|
3
3
|
export declare const updateAccountNodeChildren: (contentConfiguration: ContentConfiguration, accountPath: string) => ContentConfiguration;
|
|
4
|
-
export declare const processContentConfigurationForAccountHierarchy: (contentConfiguration: ContentConfiguration,
|
|
4
|
+
export declare const processContentConfigurationForAccountHierarchy: (contentConfiguration: ContentConfiguration, context: Record<string, any>) => ContentConfiguration;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const ACCOUNT_ENTITY_TYPE = 'core_platform-mesh_io_account';
|
|
2
2
|
export const updateEntityTypeFromAccountPath = (contentConfiguration, accountPath) => {
|
|
3
3
|
contentConfiguration.luigiConfigFragment.data.nodes.forEach((node) => {
|
|
4
|
+
if (!node.entityType.includes(ACCOUNT_ENTITY_TYPE)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
4
7
|
const accountPathParts = accountPath
|
|
5
8
|
.split(':')
|
|
6
9
|
.map((_, i) => `${ACCOUNT_ENTITY_TYPE}:${i + 1}`)
|
|
@@ -22,10 +25,13 @@ export const updateAccountNodeChildren = (contentConfiguration, accountPath) =>
|
|
|
22
25
|
}
|
|
23
26
|
return contentConfiguration;
|
|
24
27
|
};
|
|
25
|
-
export const processContentConfigurationForAccountHierarchy = (contentConfiguration,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
export const processContentConfigurationForAccountHierarchy = (contentConfiguration, context) => {
|
|
29
|
+
const accountPath = context.accountPath || context[ACCOUNT_ENTITY_TYPE];
|
|
30
|
+
if (accountPath) {
|
|
31
|
+
if (contentConfiguration.name === 'accounts') {
|
|
32
|
+
updateAccountNodeChildren(contentConfiguration, accountPath);
|
|
33
|
+
}
|
|
34
|
+
return updateEntityTypeFromAccountPath(contentConfiguration, accountPath);
|
|
28
35
|
}
|
|
29
|
-
return updateEntityTypeFromAccountPath(contentConfiguration, accountPath);
|
|
30
36
|
};
|
|
31
37
|
//# sourceMappingURL=account-hierarchy-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-hierarchy-resolver.js","sourceRoot":"","sources":["../../../src/portal-options/utils/account-hierarchy-resolver.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAE5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,oBAA0C,EAC1C,WAAmB,EACG,EAAE;IACxB,oBAAoB,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnE,MAAM,gBAAgB,GAAG,WAAW;aACjC,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aAChD,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CACvC,mBAAmB,EACnB,gBAAgB,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,oBAA0C,EAC1C,WAAmB,EACG,EAAE;IACxB,MAAM,mBAAmB,GACvB,oBAAoB,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7D,IAAI,mBAAmB,EAAE,CAAC;QACxB,mBAAmB,CAAC,YAAY,CAAC,EAAE,GAAG,GAAG,mBAAmB,IAAI,kBAAkB,EAAE,CAAC;QACrF,mBAAmB,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,mBAAmB,MAAM,kBAAkB,EAAE,CAAC;QAC1F,mBAAmB,CAAC,OAAO,CAAC,GAAG,mBAAmB,IAAI,CAAC;YACrD,IAAI,mBAAmB,MAAM,kBAAkB,EAAE,CAAC;QACpD,mBAAmB,CAAC,OAAO,CAAC,UAAU,GAAG,IAAI,mBAAmB,MAAM,kBAAkB,EAAE,CAAC;QAC3F,mBAAmB,CAAC,WAAW,GAAG,IAAI,mBAAmB,MAAM,kBAAkB,EAAE,CAAC;IACtF,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,oBAA0C,EAC1C,
|
|
1
|
+
{"version":3,"file":"account-hierarchy-resolver.js","sourceRoot":"","sources":["../../../src/portal-options/utils/account-hierarchy-resolver.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAE5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,oBAA0C,EAC1C,WAAmB,EACG,EAAE;IACxB,oBAAoB,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACnD,OAAO;QACT,CAAC;QAED,MAAM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C,GAAG,CAC5D,oBAA0C,EAC1C,OAA4B,EACN,EAAE;IACxB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACxE,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,oBAAoB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7C,yBAAyB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,+BAA+B,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platform-mesh/portal-server-lib",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20",
|
|
4
4
|
"author": "Platform Mesh",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@nestjs/testing": "11.1.9",
|
|
58
58
|
"@openmfp/config-prettier": "0.9.2",
|
|
59
59
|
"@types/jest": "30.0.0",
|
|
60
|
-
"@types/node": "24.10.
|
|
60
|
+
"@types/node": "24.10.13",
|
|
61
61
|
"@types/supertest": "6.0.3",
|
|
62
62
|
"eslint": "9.39.2",
|
|
63
63
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -79,6 +79,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
79
79
|
managedClients: {
|
|
80
80
|
org1: {
|
|
81
81
|
clientId: 'client-org1',
|
|
82
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
82
83
|
},
|
|
83
84
|
},
|
|
84
85
|
},
|
|
@@ -111,22 +112,30 @@ describe('PMAuthConfigProvider', () => {
|
|
|
111
112
|
managedClients: {
|
|
112
113
|
welcome: {
|
|
113
114
|
clientId: 'welcome',
|
|
115
|
+
secretRef: { name: 'secret-org1-welcome', namespace: 'default' },
|
|
114
116
|
},
|
|
115
117
|
},
|
|
116
118
|
},
|
|
117
119
|
} as IdentityProviderConfiguration;
|
|
118
|
-
kcpKubernetesService.
|
|
120
|
+
kcpKubernetesService.listClusterCustomObject.mockResolvedValue(
|
|
119
121
|
mockIdpConfig,
|
|
120
122
|
);
|
|
121
|
-
kcpKubernetesService.getClientSecret.mockResolvedValue('
|
|
123
|
+
kcpKubernetesService.getClientSecret.mockResolvedValue('secret-org1');
|
|
122
124
|
|
|
123
125
|
const result = await provider.getAuthConfig(mockRequest);
|
|
124
126
|
|
|
125
127
|
expect(result.clientId).toBe('welcome');
|
|
126
|
-
expect(result.clientSecret).toBe('
|
|
127
|
-
expect(
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
expect(result.clientSecret).toBe('secret-org1');
|
|
129
|
+
expect(kcpKubernetesService.listClusterCustomObject).toHaveBeenCalledWith(
|
|
130
|
+
{
|
|
131
|
+
group: 'core.platform-mesh.io',
|
|
132
|
+
name: 'welcome',
|
|
133
|
+
plural: 'identityproviderconfigurations',
|
|
134
|
+
version: 'v1alpha1',
|
|
135
|
+
},
|
|
136
|
+
{ organization: 'welcome' },
|
|
137
|
+
'root:platform-mesh-system',
|
|
138
|
+
);
|
|
130
139
|
});
|
|
131
140
|
|
|
132
141
|
it('should fall back to default auth URLs when OIDC discovery fails', async () => {
|
|
@@ -137,6 +146,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
137
146
|
managedClients: {
|
|
138
147
|
org1: {
|
|
139
148
|
clientId: 'client-org1',
|
|
149
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
140
150
|
},
|
|
141
151
|
},
|
|
142
152
|
},
|
|
@@ -164,6 +174,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
164
174
|
managedClients: {
|
|
165
175
|
org1: {
|
|
166
176
|
clientId: 'client-org1',
|
|
177
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
167
178
|
},
|
|
168
179
|
},
|
|
169
180
|
},
|
|
@@ -191,6 +202,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
191
202
|
managedClients: {
|
|
192
203
|
org1: {
|
|
193
204
|
clientId: 'client-org1',
|
|
205
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
194
206
|
},
|
|
195
207
|
},
|
|
196
208
|
},
|
|
@@ -212,6 +224,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
212
224
|
managedClients: {
|
|
213
225
|
org1: {
|
|
214
226
|
clientId: '',
|
|
227
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
215
228
|
},
|
|
216
229
|
},
|
|
217
230
|
},
|
|
@@ -233,6 +246,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
233
246
|
managedClients: {
|
|
234
247
|
org1: {
|
|
235
248
|
clientId: 'client-org1',
|
|
249
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
236
250
|
},
|
|
237
251
|
},
|
|
238
252
|
},
|
|
@@ -257,6 +271,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
257
271
|
managedClients: {
|
|
258
272
|
org1: {
|
|
259
273
|
clientId: 'client-org1',
|
|
274
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
260
275
|
},
|
|
261
276
|
},
|
|
262
277
|
},
|
|
@@ -285,6 +300,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
285
300
|
managedClients: {
|
|
286
301
|
org1: {
|
|
287
302
|
clientId: 'client-org1',
|
|
303
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
288
304
|
},
|
|
289
305
|
},
|
|
290
306
|
},
|
|
@@ -308,6 +324,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
308
324
|
managedClients: {
|
|
309
325
|
org1: {
|
|
310
326
|
clientId: 'client-org1',
|
|
327
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
311
328
|
},
|
|
312
329
|
},
|
|
313
330
|
},
|
|
@@ -329,6 +346,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
329
346
|
managedClients: {
|
|
330
347
|
org1: {
|
|
331
348
|
clientId: 'client-org1',
|
|
349
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
332
350
|
},
|
|
333
351
|
},
|
|
334
352
|
},
|
|
@@ -354,6 +372,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
354
372
|
managedClients: {
|
|
355
373
|
org1: {
|
|
356
374
|
clientId: 'client-org1',
|
|
375
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
357
376
|
},
|
|
358
377
|
},
|
|
359
378
|
},
|
|
@@ -376,6 +395,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
376
395
|
{
|
|
377
396
|
organization: 'org1',
|
|
378
397
|
},
|
|
398
|
+
undefined,
|
|
379
399
|
);
|
|
380
400
|
});
|
|
381
401
|
|
|
@@ -409,6 +429,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
409
429
|
managedClients: {
|
|
410
430
|
org1: {
|
|
411
431
|
clientId: 'client-org1',
|
|
432
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
412
433
|
},
|
|
413
434
|
},
|
|
414
435
|
},
|
|
@@ -431,6 +452,7 @@ describe('PMAuthConfigProvider', () => {
|
|
|
431
452
|
managedClients: {
|
|
432
453
|
org1: {
|
|
433
454
|
clientId: 'client-org1',
|
|
455
|
+
secretRef: { name: 'secret-org1', namespace: 'default' },
|
|
434
456
|
},
|
|
435
457
|
},
|
|
436
458
|
},
|
|
@@ -23,14 +23,9 @@ export class PMAuthConfigProvider implements AuthConfigService {
|
|
|
23
23
|
const oidcUrl = getDiscoveryEndpoint(request);
|
|
24
24
|
const org = getOrganization(request);
|
|
25
25
|
|
|
26
|
-
const clientId = await this.readClientId(org);
|
|
26
|
+
const { clientId, secretRefName } = await this.readClientId(org);
|
|
27
27
|
const clientSecret =
|
|
28
|
-
|
|
29
|
-
? await this.kcpKubernetesService.getClientSecret(
|
|
30
|
-
org,
|
|
31
|
-
`portal-client-secret-${org}`,
|
|
32
|
-
)
|
|
33
|
-
: await this.kcpKubernetesService.getClientSecret(org);
|
|
28
|
+
await this.kcpKubernetesService.getClientSecret(secretRefName);
|
|
34
29
|
|
|
35
30
|
const baseDomain = process.env['BASE_DOMAINS_DEFAULT'];
|
|
36
31
|
const oidc = await this.discoveryService.getOIDC(oidcUrl);
|
|
@@ -65,7 +60,9 @@ export class PMAuthConfigProvider implements AuthConfigService {
|
|
|
65
60
|
};
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
private async readClientId(
|
|
63
|
+
private async readClientId(
|
|
64
|
+
orgName: string,
|
|
65
|
+
): Promise<{ clientId: string; secretRefName: string }> {
|
|
69
66
|
const k8sResourceDescriptor: K8sResourceDescriptor = {
|
|
70
67
|
group: 'core.platform-mesh.io',
|
|
71
68
|
version: 'v1alpha1',
|
|
@@ -73,22 +70,18 @@ export class PMAuthConfigProvider implements AuthConfigService {
|
|
|
73
70
|
name: orgName,
|
|
74
71
|
};
|
|
75
72
|
|
|
76
|
-
if (orgName === 'welcome') {
|
|
77
|
-
const result: IdentityProviderConfiguration =
|
|
78
|
-
await this.kcpKubernetesService.getClusterCustomObjectByWorkspacePath(
|
|
79
|
-
k8sResourceDescriptor,
|
|
80
|
-
'root:platform-mesh-system',
|
|
81
|
-
);
|
|
82
|
-
return result.status.managedClients[orgName].clientId;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
73
|
const result: IdentityProviderConfiguration =
|
|
86
74
|
await this.kcpKubernetesService.listClusterCustomObject(
|
|
87
75
|
k8sResourceDescriptor,
|
|
88
76
|
{
|
|
89
77
|
organization: orgName,
|
|
90
78
|
},
|
|
79
|
+
orgName === 'welcome' ? 'root:platform-mesh-system' : undefined,
|
|
91
80
|
);
|
|
92
|
-
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
clientId: result.status.managedClients[orgName].clientId,
|
|
84
|
+
secretRefName: result.status.managedClients[orgName].secretRef.name,
|
|
85
|
+
};
|
|
93
86
|
}
|
|
94
87
|
}
|
package/src/portal-options/service-providers/content-configuration-service-providers.service.ts
CHANGED
|
@@ -86,14 +86,10 @@ export class ContentConfigurationServiceProvidersService implements ServiceProvi
|
|
|
86
86
|
contentConfiguration.url = item.spec.remoteConfiguration?.url;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
contentConfiguration,
|
|
94
|
-
accountPath,
|
|
95
|
-
);
|
|
96
|
-
}
|
|
89
|
+
processContentConfigurationForAccountHierarchy(
|
|
90
|
+
contentConfiguration,
|
|
91
|
+
context,
|
|
92
|
+
);
|
|
97
93
|
|
|
98
94
|
return contentConfiguration;
|
|
99
95
|
} catch (parseError) {
|
|
@@ -289,67 +289,6 @@ describe('KubernetesServiceProvidersService', () => {
|
|
|
289
289
|
);
|
|
290
290
|
});
|
|
291
291
|
|
|
292
|
-
it('should use main entity when entities array is empty', async () => {
|
|
293
|
-
const mockResponse = { items: [] };
|
|
294
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace.mockResolvedValue(
|
|
295
|
-
mockResponse as any,
|
|
296
|
-
);
|
|
297
|
-
|
|
298
|
-
await service.getServiceProviders(mockToken, [], mockContext);
|
|
299
|
-
|
|
300
|
-
expect(
|
|
301
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace,
|
|
302
|
-
).toHaveBeenCalledWith(
|
|
303
|
-
expect.objectContaining({
|
|
304
|
-
labelSelector: 'ui.platform-mesh.io/entity=main',
|
|
305
|
-
}),
|
|
306
|
-
mockContext,
|
|
307
|
-
mockToken,
|
|
308
|
-
);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('should use main entity when entities is null', async () => {
|
|
312
|
-
const mockResponse = { items: [] };
|
|
313
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace.mockResolvedValue(
|
|
314
|
-
mockResponse as any,
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
await service.getServiceProviders(mockToken, null as any, mockContext);
|
|
318
|
-
|
|
319
|
-
expect(
|
|
320
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace,
|
|
321
|
-
).toHaveBeenCalledWith(
|
|
322
|
-
expect.objectContaining({
|
|
323
|
-
labelSelector: 'ui.platform-mesh.io/entity=main',
|
|
324
|
-
}),
|
|
325
|
-
mockContext,
|
|
326
|
-
mockToken,
|
|
327
|
-
);
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
it('should use first entity from array', async () => {
|
|
331
|
-
const mockResponse = { items: [] };
|
|
332
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace.mockResolvedValue(
|
|
333
|
-
mockResponse as any,
|
|
334
|
-
);
|
|
335
|
-
|
|
336
|
-
await service.getServiceProviders(
|
|
337
|
-
mockToken,
|
|
338
|
-
['entity1', 'entity2'],
|
|
339
|
-
mockContext,
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
expect(
|
|
343
|
-
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace,
|
|
344
|
-
).toHaveBeenCalledWith(
|
|
345
|
-
expect.objectContaining({
|
|
346
|
-
labelSelector: 'ui.platform-mesh.io/entity=entity1',
|
|
347
|
-
}),
|
|
348
|
-
mockContext,
|
|
349
|
-
mockToken,
|
|
350
|
-
);
|
|
351
|
-
});
|
|
352
|
-
|
|
353
292
|
it('should call kubernetes service with correct GVR', async () => {
|
|
354
293
|
const mockResponse = { items: [] };
|
|
355
294
|
kcpKubernetesServiceMock.listClusterCustomObjectInKcpVirtualWorkspace.mockResolvedValue(
|
|
@@ -362,7 +301,6 @@ describe('KubernetesServiceProvidersService', () => {
|
|
|
362
301
|
group: 'ui.platform-mesh.io',
|
|
363
302
|
version: 'v1alpha1',
|
|
364
303
|
plural: 'contentconfigurations',
|
|
365
|
-
labelSelector: 'ui.platform-mesh.io/entity=test-entity',
|
|
366
304
|
};
|
|
367
305
|
|
|
368
306
|
expect(
|
|
@@ -33,7 +33,6 @@ export class KubernetesServiceProvidersService implements ServiceProviderService
|
|
|
33
33
|
|
|
34
34
|
const response = await this.listContentConfigurationsForEntity(
|
|
35
35
|
token,
|
|
36
|
-
entities,
|
|
37
36
|
context as K8sRequestContext,
|
|
38
37
|
);
|
|
39
38
|
|
|
@@ -55,14 +54,10 @@ export class KubernetesServiceProvidersService implements ServiceProviderService
|
|
|
55
54
|
contentConfiguration.url = item.spec.remoteConfiguration?.url;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
contentConfiguration,
|
|
63
|
-
accountPath,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
57
|
+
processContentConfigurationForAccountHierarchy(
|
|
58
|
+
contentConfiguration,
|
|
59
|
+
context,
|
|
60
|
+
);
|
|
66
61
|
|
|
67
62
|
return contentConfiguration;
|
|
68
63
|
});
|
|
@@ -81,15 +76,12 @@ export class KubernetesServiceProvidersService implements ServiceProviderService
|
|
|
81
76
|
|
|
82
77
|
private async listContentConfigurationsForEntity(
|
|
83
78
|
token: string,
|
|
84
|
-
entities: string[],
|
|
85
79
|
context: K8sRequestContext,
|
|
86
80
|
) {
|
|
87
|
-
const entity = !entities || !entities.length ? 'main' : entities[0];
|
|
88
81
|
const gvr: K8sResourceDescriptor = {
|
|
89
82
|
group: 'ui.platform-mesh.io',
|
|
90
83
|
version: 'v1alpha1',
|
|
91
84
|
plural: 'contentconfigurations',
|
|
92
|
-
labelSelector: `ui.platform-mesh.io/entity=${entity}`,
|
|
93
85
|
};
|
|
94
86
|
|
|
95
87
|
try {
|
|
@@ -553,7 +553,6 @@ describe('KcpKubernetesService', () => {
|
|
|
553
553
|
describe('getClientSecret', () => {
|
|
554
554
|
it('retrieves and decodes client secret successfully', async () => {
|
|
555
555
|
const svc = new KcpKubernetesService();
|
|
556
|
-
const orgName = 'test-org';
|
|
557
556
|
const encodedSecret = Buffer.from('my-secret-value').toString('base64');
|
|
558
557
|
|
|
559
558
|
mockReadNamespacedSecret.mockResolvedValue({
|
|
@@ -562,7 +561,9 @@ describe('KcpKubernetesService', () => {
|
|
|
562
561
|
},
|
|
563
562
|
});
|
|
564
563
|
|
|
565
|
-
const result = await svc.getClientSecret(
|
|
564
|
+
const result = await svc.getClientSecret(
|
|
565
|
+
'portal-client-secret-test-org-test-org',
|
|
566
|
+
);
|
|
566
567
|
|
|
567
568
|
expect(result).toBe('my-secret-value');
|
|
568
569
|
expect(mockReadNamespacedSecret).toHaveBeenCalledWith(
|
|
@@ -578,7 +579,6 @@ describe('KcpKubernetesService', () => {
|
|
|
578
579
|
|
|
579
580
|
it('builds correct secret name and namespace', async () => {
|
|
580
581
|
const svc = new KcpKubernetesService();
|
|
581
|
-
const orgName = 'my-company';
|
|
582
582
|
|
|
583
583
|
mockReadNamespacedSecret.mockResolvedValue({
|
|
584
584
|
data: {
|
|
@@ -586,7 +586,7 @@ describe('KcpKubernetesService', () => {
|
|
|
586
586
|
},
|
|
587
587
|
});
|
|
588
588
|
|
|
589
|
-
await svc.getClientSecret(
|
|
589
|
+
await svc.getClientSecret('portal-client-secret-my-company-my-company');
|
|
590
590
|
|
|
591
591
|
expect(mockReadNamespacedSecret).toHaveBeenCalledWith(
|
|
592
592
|
{
|
|
@@ -599,7 +599,6 @@ describe('KcpKubernetesService', () => {
|
|
|
599
599
|
|
|
600
600
|
it('uses correct workspace URL in middleware', async () => {
|
|
601
601
|
const svc = new KcpKubernetesService();
|
|
602
|
-
const orgName = 'url-org';
|
|
603
602
|
|
|
604
603
|
let capturedContext: any;
|
|
605
604
|
mockReadNamespacedSecret.mockImplementation(async (params, options) => {
|
|
@@ -616,7 +615,7 @@ describe('KcpKubernetesService', () => {
|
|
|
616
615
|
};
|
|
617
616
|
});
|
|
618
617
|
|
|
619
|
-
await svc.getClientSecret(
|
|
618
|
+
await svc.getClientSecret('portal-client-secret-url-org-url-org');
|
|
620
619
|
|
|
621
620
|
expect(capturedContext.setUrl).toHaveBeenCalledWith(
|
|
622
621
|
'https://kcp.example.com/clusters/root:orgs/api/v1/namespaces/default/secrets/portal-client-secret-url-org-url-org',
|
|
@@ -84,8 +84,13 @@ export class KcpKubernetesService {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
getKcpWorkspaceUrl(
|
|
88
|
-
|
|
87
|
+
getKcpWorkspaceUrl(
|
|
88
|
+
organization?: string,
|
|
89
|
+
account?: string,
|
|
90
|
+
workspacePath?: string,
|
|
91
|
+
) {
|
|
92
|
+
const path =
|
|
93
|
+
workspacePath || this.buildWorkspacePath(organization, account);
|
|
89
94
|
return new URL(`${this.baseUrl.origin}/clusters/${path}`);
|
|
90
95
|
}
|
|
91
96
|
|
|
@@ -121,6 +126,7 @@ export class KcpKubernetesService {
|
|
|
121
126
|
public async listClusterCustomObject(
|
|
122
127
|
gvr: K8sResourceDescriptor,
|
|
123
128
|
requestContext: K8sRequestContext,
|
|
129
|
+
workspacePath?: string,
|
|
124
130
|
) {
|
|
125
131
|
return await this.k8sCustomObjectsApi.listClusterCustomObject(gvr, {
|
|
126
132
|
middleware: [
|
|
@@ -133,6 +139,7 @@ export class KcpKubernetesService {
|
|
|
133
139
|
const kcpUrl = this.getKcpWorkspaceUrl(
|
|
134
140
|
requestContext.organization,
|
|
135
141
|
accountPath,
|
|
142
|
+
workspacePath,
|
|
136
143
|
);
|
|
137
144
|
const path = `${kcpUrl}/apis/${gvr.group}/${gvr.version}/${gvr.plural}/${gvr.name}`;
|
|
138
145
|
this.logger.log(`kcp url: ${path}`);
|
|
@@ -145,25 +152,6 @@ export class KcpKubernetesService {
|
|
|
145
152
|
});
|
|
146
153
|
}
|
|
147
154
|
|
|
148
|
-
public async getClusterCustomObjectByWorkspacePath(
|
|
149
|
-
gvr: K8sResourceDescriptor,
|
|
150
|
-
workspacePath: string,
|
|
151
|
-
) {
|
|
152
|
-
return await this.k8sCustomObjectsApi.listClusterCustomObject(gvr, {
|
|
153
|
-
middleware: [
|
|
154
|
-
new PromiseMiddlewareWrapper({
|
|
155
|
-
pre: async (context) => {
|
|
156
|
-
const path = `${this.baseUrl.origin}/clusters/${workspacePath}/apis/${gvr.group}/${gvr.version}/${gvr.plural}/${gvr.name}`;
|
|
157
|
-
this.logger.log(`kcp url: ${path}`);
|
|
158
|
-
context.setUrl(path);
|
|
159
|
-
return context;
|
|
160
|
-
},
|
|
161
|
-
post: async (context) => context,
|
|
162
|
-
}),
|
|
163
|
-
],
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
155
|
public async listClusterCustomObjectInKcpVirtualWorkspace(
|
|
168
156
|
gvr: K8sResourceDescriptor,
|
|
169
157
|
requestContext: K8sRequestContext,
|
|
@@ -194,9 +182,7 @@ export class KcpKubernetesService {
|
|
|
194
182
|
});
|
|
195
183
|
}
|
|
196
184
|
|
|
197
|
-
public async getClientSecret(
|
|
198
|
-
const secretName =
|
|
199
|
-
secretNameOverride ?? `portal-client-secret-${orgName}-${orgName}`;
|
|
185
|
+
public async getClientSecret(secretName: string) {
|
|
200
186
|
const namespace = 'default';
|
|
201
187
|
|
|
202
188
|
try {
|
|
@@ -260,10 +260,9 @@ describe('processContentConfigurationForAccountHierarchy', () => {
|
|
|
260
260
|
},
|
|
261
261
|
});
|
|
262
262
|
|
|
263
|
-
const result = processContentConfigurationForAccountHierarchy(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
);
|
|
263
|
+
const result = processContentConfigurationForAccountHierarchy(config, {
|
|
264
|
+
accountPath: 'acc1',
|
|
265
|
+
});
|
|
267
266
|
const childNode = result.luigiConfigFragment.data.nodes[0]
|
|
268
267
|
.children?.[0] as any;
|
|
269
268
|
|
|
@@ -294,10 +293,9 @@ describe('processContentConfigurationForAccountHierarchy', () => {
|
|
|
294
293
|
},
|
|
295
294
|
});
|
|
296
295
|
|
|
297
|
-
const result = processContentConfigurationForAccountHierarchy(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
);
|
|
296
|
+
const result = processContentConfigurationForAccountHierarchy(config, {
|
|
297
|
+
accountPath: 'acc1',
|
|
298
|
+
});
|
|
301
299
|
const childNode = result.luigiConfigFragment.data.nodes[0]
|
|
302
300
|
.children?.[0] as any;
|
|
303
301
|
|
|
@@ -317,10 +315,9 @@ describe('processContentConfigurationForAccountHierarchy', () => {
|
|
|
317
315
|
},
|
|
318
316
|
});
|
|
319
317
|
|
|
320
|
-
const result = processContentConfigurationForAccountHierarchy(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
);
|
|
318
|
+
const result = processContentConfigurationForAccountHierarchy(config, {
|
|
319
|
+
accountPath: 'acc1:acc2',
|
|
320
|
+
});
|
|
324
321
|
|
|
325
322
|
expect(result.luigiConfigFragment.data.nodes[0].entityType).toBe(
|
|
326
323
|
'core_platform-mesh_io_account:1.core_platform-mesh_io_account:2',
|
|
@@ -337,10 +334,9 @@ describe('processContentConfigurationForAccountHierarchy', () => {
|
|
|
337
334
|
},
|
|
338
335
|
});
|
|
339
336
|
|
|
340
|
-
const result = processContentConfigurationForAccountHierarchy(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
);
|
|
337
|
+
const result = processContentConfigurationForAccountHierarchy(config, {
|
|
338
|
+
accountPath: 'acc1',
|
|
339
|
+
});
|
|
344
340
|
|
|
345
341
|
expect(result).toBe(config);
|
|
346
342
|
});
|
|
@@ -7,6 +7,10 @@ export const updateEntityTypeFromAccountPath = (
|
|
|
7
7
|
accountPath: string,
|
|
8
8
|
): ContentConfiguration => {
|
|
9
9
|
contentConfiguration.luigiConfigFragment.data.nodes.forEach((node) => {
|
|
10
|
+
if (!node.entityType.includes(ACCOUNT_ENTITY_TYPE)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const accountPathParts = accountPath
|
|
11
15
|
.split(':')
|
|
12
16
|
.map((_, i) => `${ACCOUNT_ENTITY_TYPE}:${i + 1}`)
|
|
@@ -43,11 +47,14 @@ export const updateAccountNodeChildren = (
|
|
|
43
47
|
|
|
44
48
|
export const processContentConfigurationForAccountHierarchy = (
|
|
45
49
|
contentConfiguration: ContentConfiguration,
|
|
46
|
-
|
|
50
|
+
context: Record<string, any>,
|
|
47
51
|
): ContentConfiguration => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
const accountPath = context.accountPath || context[ACCOUNT_ENTITY_TYPE];
|
|
53
|
+
if (accountPath) {
|
|
54
|
+
if (contentConfiguration.name === 'accounts') {
|
|
55
|
+
updateAccountNodeChildren(contentConfiguration, accountPath);
|
|
56
|
+
}
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
return updateEntityTypeFromAccountPath(contentConfiguration, accountPath);
|
|
59
|
+
}
|
|
53
60
|
};
|