feat(auth): ScadaBridge TransportExport excludes inbound API keys (re-arch C4; methods-only, import ignores legacy key sections); keys re-issued per environment
This commit is contained in:
@@ -82,7 +82,7 @@ public sealed class BundleExporter : IBundleExporter
|
||||
DatabaseConnections: resolved.DatabaseConnections,
|
||||
NotificationLists: resolved.NotificationLists,
|
||||
SmtpConfigurations: resolved.SmtpConfigs,
|
||||
ApiKeys: resolved.ApiKeys,
|
||||
// Inbound API keys are not transported between environments (re-arch C4).
|
||||
ApiMethods: resolved.ApiMethods);
|
||||
var contentDto = _entitySerializer.ToBundleContent(aggregate);
|
||||
|
||||
@@ -95,7 +95,6 @@ public sealed class BundleExporter : IBundleExporter
|
||||
DbConnections: resolved.DatabaseConnections.Count,
|
||||
NotificationLists: resolved.NotificationLists.Count,
|
||||
SmtpConfigs: resolved.SmtpConfigs.Count,
|
||||
ApiKeys: resolved.ApiKeys.Count,
|
||||
ApiMethods: resolved.ApiMethods.Count);
|
||||
|
||||
// 4. Build a TEMPLATE manifest. BundleSerializer.Pack re-stamps both
|
||||
|
||||
@@ -98,13 +98,9 @@ public sealed class DependencyResolver
|
||||
if (sm is not null) smtpConfigs[sm.Id] = sm;
|
||||
}
|
||||
|
||||
var apiKeys = new Dictionary<int, ApiKey>();
|
||||
foreach (var id in selection.ApiKeyIds.Distinct())
|
||||
{
|
||||
var k = await _inboundApi.GetApiKeyByIdAsync(id, ct).ConfigureAwait(false);
|
||||
if (k is not null) apiKeys[k.Id] = k;
|
||||
}
|
||||
|
||||
// Inbound API keys are intentionally NOT resolved into the bundle: per the
|
||||
// inbound-API-key re-architecture (C4) keys are not transported between
|
||||
// environments. Only API methods travel.
|
||||
var apiMethods = new Dictionary<int, ApiMethod>();
|
||||
foreach (var id in selection.ApiMethodIds.Distinct())
|
||||
{
|
||||
@@ -148,7 +144,6 @@ public sealed class DependencyResolver
|
||||
dbConnections.Values,
|
||||
notificationLists.Values,
|
||||
smtpConfigs.Values,
|
||||
apiKeys.Values,
|
||||
apiMethods.Values);
|
||||
|
||||
return new ResolvedExport(
|
||||
@@ -160,7 +155,6 @@ public sealed class DependencyResolver
|
||||
DatabaseConnections: dbConnections.Values.OrderBy(d => d.Name, StringComparer.Ordinal).ToList(),
|
||||
NotificationLists: notificationLists.Values.OrderBy(n => n.Name, StringComparer.Ordinal).ToList(),
|
||||
SmtpConfigs: smtpConfigs.Values.OrderBy(s => s.Host, StringComparer.Ordinal).ToList(),
|
||||
ApiKeys: apiKeys.Values.OrderBy(a => a.Name, StringComparer.Ordinal).ToList(),
|
||||
ApiMethods: apiMethods.Values.OrderBy(a => a.Name, StringComparer.Ordinal).ToList(),
|
||||
ContentManifest: manifest);
|
||||
}
|
||||
@@ -368,7 +362,6 @@ public sealed class DependencyResolver
|
||||
IEnumerable<DatabaseConnectionDefinition> dbConnections,
|
||||
IEnumerable<NotificationList> notificationLists,
|
||||
IEnumerable<SmtpConfiguration> smtpConfigs,
|
||||
IEnumerable<ApiKey> apiKeys,
|
||||
IEnumerable<ApiMethod> apiMethods)
|
||||
{
|
||||
var entries = new List<ManifestContentEntry>();
|
||||
@@ -419,10 +412,7 @@ public sealed class DependencyResolver
|
||||
{
|
||||
entries.Add(new ManifestContentEntry("SmtpConfiguration", s.Host, 1, Array.Empty<string>()));
|
||||
}
|
||||
foreach (var k in apiKeys.OrderBy(x => x.Name, StringComparer.Ordinal))
|
||||
{
|
||||
entries.Add(new ManifestContentEntry("ApiKey", k.Name, 1, Array.Empty<string>()));
|
||||
}
|
||||
// Inbound API keys are not transported (re-arch C4) — no ApiKey manifest entries.
|
||||
foreach (var m in apiMethods.OrderBy(x => x.Name, StringComparer.Ordinal))
|
||||
{
|
||||
entries.Add(new ManifestContentEntry("ApiMethod", m.Name, 1, Array.Empty<string>()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems;
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.InboundApi;
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.InboundApi; // ApiMethod
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications;
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Scripts;
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
|
||||
@@ -23,6 +23,6 @@ public sealed record ResolvedExport(
|
||||
IReadOnlyList<DatabaseConnectionDefinition> DatabaseConnections,
|
||||
IReadOnlyList<NotificationList> NotificationLists,
|
||||
IReadOnlyList<SmtpConfiguration> SmtpConfigs,
|
||||
IReadOnlyList<ApiKey> ApiKeys,
|
||||
// Inbound API keys are not transported between environments (re-arch C4); only methods.
|
||||
IReadOnlyList<ApiMethod> ApiMethods,
|
||||
IReadOnlyList<ManifestContentEntry> ContentManifest);
|
||||
|
||||
Reference in New Issue
Block a user