refactor(adminui): tidy cert-audit review nits (fallthrough comment + single PkiStoreRoot read)
This commit is contained in:
@@ -29,6 +29,13 @@ public sealed class CertificateStoreManager
|
|||||||
private readonly string _pkiRoot;
|
private readonly string _pkiRoot;
|
||||||
private readonly IAuditWriter _audit;
|
private readonly IAuditWriter _audit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The resolved PKI store root directory (e.g. <c>pki</c>). Derived once from
|
||||||
|
/// <c>OpcUa:PkiStoreRoot</c> in the production ctor; callers should read this property
|
||||||
|
/// rather than re-resolving the config key independently.
|
||||||
|
/// </summary>
|
||||||
|
public string PkiRoot => _pkiRoot;
|
||||||
|
|
||||||
/// <summary>Production ctor — reads <c>OpcUa:PkiStoreRoot</c> (default <c>pki</c>).</summary>
|
/// <summary>Production ctor — reads <c>OpcUa:PkiStoreRoot</c> (default <c>pki</c>).</summary>
|
||||||
/// <param name="config">App configuration.</param>
|
/// <param name="config">App configuration.</param>
|
||||||
/// <param name="audit">The audit writer that persists Trust/Untrust/Delete actions to <c>ConfigAuditLog</c>.</param>
|
/// <param name="audit">The audit writer that persists Trust/Untrust/Delete actions to <c>ConfigAuditLog</c>.</param>
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ else
|
|||||||
private void LoadAll()
|
private void LoadAll()
|
||||||
{
|
{
|
||||||
DisposeRows();
|
DisposeRows();
|
||||||
var pkiRoot = Config.GetValue<string?>("OpcUa:PkiStoreRoot") ?? "pki";
|
var pkiRoot = CertManager.PkiRoot; // Single source: manager already resolved OpcUa:PkiStoreRoot (default "pki").
|
||||||
_rows = new()
|
_rows = new()
|
||||||
{
|
{
|
||||||
LoadStore("Own", StoreKind.Own, Path.Combine(pkiRoot, "own", "certs")),
|
LoadStore("Own", StoreKind.Own, Path.Combine(pkiRoot, "own", "certs")),
|
||||||
@@ -200,8 +200,14 @@ else
|
|||||||
{
|
{
|
||||||
StoreKind.Trusted => CertManager.Delete("trusted", p.Thumbprint, actor),
|
StoreKind.Trusted => CertManager.Delete("trusted", p.Thumbprint, actor),
|
||||||
StoreKind.Rejected => CertManager.Delete("rejected", p.Thumbprint, actor),
|
StoreKind.Rejected => CertManager.Delete("rejected", p.Thumbprint, actor),
|
||||||
|
// Unreachable defensive guard — action buttons only render for Trusted/Rejected stores
|
||||||
|
// + the 3 literal verbs (Trust/Untrust/Delete); this arm never executes, so it
|
||||||
|
// intentionally does not route through CertificateStoreManager/audit.
|
||||||
_ => CertActionResult.Fail($"cannot delete from {p.Kind}"),
|
_ => CertActionResult.Fail($"cannot delete from {p.Kind}"),
|
||||||
},
|
},
|
||||||
|
// Unreachable defensive guard — action buttons only render for Trusted/Rejected stores
|
||||||
|
// + the 3 literal verbs (Trust/Untrust/Delete); this arm never executes, so it
|
||||||
|
// intentionally does not route through CertificateStoreManager/audit.
|
||||||
_ => CertActionResult.Fail("unknown action"),
|
_ => CertActionResult.Fail("unknown action"),
|
||||||
};
|
};
|
||||||
_statusError = !result.Success;
|
_statusError = !result.Success;
|
||||||
|
|||||||
Reference in New Issue
Block a user