[성현모] Web Operation 기능 추가

This commit is contained in:
SHM
2026-02-02 15:14:39 +09:00
parent e673cc20cf
commit 0475d60409
10 changed files with 428 additions and 6 deletions

View File

@ -9,7 +9,12 @@
{ {
"Id": 1, "Id": 1,
"ApiName": "CPMetaWbms", "ApiName": "CPMetaWbms",
"Host": "192.168.0.126:9000" "Host": "192.168.0.126:9000"
},
{
"Id": 2,
"ApiNmae": "ProxyKms",
"Host": "https://127.0.0.1:9200"
} }
] ]
} }

View File

@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "10.0.2",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}

View File

@ -31,7 +31,7 @@ namespace WebApi.Project.ProxyKMS.Models
} }
public class Response_SupplierKeyProvisioning : Response_Common public class Response_SupplierKeyProvisioning : Response_Common
{ {
public SupplierKeyProvisioningRecords Records { get; set; } = new SupplierKeyProvisioningRecords(); public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record #region record
public class SupplierKeyProvisioningRecords public class SupplierKeyProvisioningRecords
@ -70,7 +70,7 @@ namespace WebApi.Project.ProxyKMS.Models
} }
public class Response_SupplierKeyProvisioning : Response_Common public class Response_SupplierKeyProvisioning : Response_Common
{ {
public SupplierKeyProvisioningRecords Records { get; set; } = new SupplierKeyProvisioningRecords(); public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record #region record
public class SupplierKeyProvisioningRecords public class SupplierKeyProvisioningRecords
@ -104,7 +104,7 @@ namespace WebApi.Project.ProxyKMS.Models
} }
public class Response_SupplierKeySyncValue : Response_Common public class Response_SupplierKeySyncValue : Response_Common
{ {
public SupplierKeySyncValueRecords Records { get; set; } = new SupplierKeySyncValueRecords(); public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
#region record #region record
public class SupplierKeySyncValueRecords public class SupplierKeySyncValueRecords
@ -143,7 +143,7 @@ namespace WebApi.Project.ProxyKMS.Models
} }
public class Response_SupplierKeyProvisioning : Response_Common public class Response_SupplierKeyProvisioning : Response_Common
{ {
public SupplierKeyProvisioningRecords Records { get; set; } = new SupplierKeyProvisioningRecords(); public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record #region record
public class SupplierKeyProvisioningRecords public class SupplierKeyProvisioningRecords
@ -179,7 +179,7 @@ namespace WebApi.Project.ProxyKMS.Models
} }
public class Response_SupplierKeySyncValue : Response_Common public class Response_SupplierKeySyncValue : Response_Common
{ {
public SupplierKeySyncValueRecords Records { get; set; } = new SupplierKeySyncValueRecords(); public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
#region record #region record
public class SupplierKeySyncValueRecords public class SupplierKeySyncValueRecords

View File

@ -15,6 +15,7 @@
<RadzenPanelMenu> <RadzenPanelMenu>
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/"/> <RadzenPanelMenuItem Text="Home" Icon="home" Path="/"/>
<RadzenPanelMenuItem Text="CPMeta" Icon="assignment" Path="/CpMeta"/> <RadzenPanelMenuItem Text="CPMeta" Icon="assignment" Path="/CpMeta"/>
<RadzenPanelMenuItem Text="ProxyKms" Icon="assignment" Path="/ProxyKms"/>
</RadzenPanelMenu> </RadzenPanelMenu>
</RadzenSidebar> </RadzenSidebar>
<RadzenBody Style="margin:0; padding:1rem; overflow:hidden; font-size: 2rem;"> <RadzenBody Style="margin:0; padding:1rem; overflow:hidden; font-size: 2rem;">

View File

@ -0,0 +1,66 @@
@page "/ProxyKMS"
@using Web.Operation.Packet
@using Web.Operation.Module
@inject ConfigService<WebClientConfig> _configService
<h3>ProxyKMS</h3>
<div style="height: calc(100% - 2.5rem); overflow:auto; margin-bottom: 10rem;">
<RadzenFieldset Text="EcuID">
<ProxyKmsModule Title="SupplierEcuID" TRequest="EcuID.Request_SupplierEcuID" TResponse="EcuID.Response_SupplierEcuID" Method="POST" Url="@($"{ApiAddress}/kms/ecuid/supplierEcuID")">
</ProxyKmsModule>
</RadzenFieldset>
<br />
<RadzenFieldset Text="MasterECUKey">
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="MasterEcuKey.Request_SupplierKeyProvisioning" TResponse="MasterEcuKey.Response_SupplierKeyProvisioning" Method="POST" Url="@($"{ApiAddress}/kms/MasterEcuKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="MasterEcuKey.Request_SupplierKeyProvisioning_Result" TResponse="MasterEcuKey.Response_SupplierKeyProvisioning_Result" Method="PUT" Url="@($"{ApiAddress}/kms/MasterEcuKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
</RadzenFieldset>
<br />
<RadzenFieldset Text="SupplierSymmKey">
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="SupplierSymmKey.Request_SupplierKeyProvisioning" TResponse="SupplierSymmKey.Response_SupplierKeyProvisioning" Method="POST" Url="@($"{ApiAddress}/kms/SupplierSymmKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="SupplierSymmKey.Request_SupplierKeyProvisioning_Result" TResponse="SupplierSymmKey.Response_SupplierKeyProvisioning_Result" Method="PUT" Url="@($"{ApiAddress}/kms/SupplierSymmKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeySyncValue" TRequest="SupplierSymmKey.Request_SupplierKeySyncValue" TResponse="SupplierSymmKey.Response_SupplierKeySyncValue" Method="POST" Url="@($"{ApiAddress}/kms/SupplierSymmKey/SupplierKeySyncValue")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeySyncValue" TRequest="SupplierSymmKey.Request_SupplierKeySyncValue_Result" TResponse="SupplierSymmKey.Response_SupplierKeySyncValue_Result" Method="PUT" Url="@($"{ApiAddress}/kms/SupplierSymmKey/SupplierKeySyncValue")">
</ProxyKmsModule>
</RadzenFieldset>
<br />
<RadzenFieldset Text="SecOCKey">
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="SecOCKey.Request_SupplierKeyProvisioning" TResponse="SecOCKey.Response_SupplierKeyProvisioning" Method="POST" Url="@($"{ApiAddress}/kms/SecOCKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeyProvisioning" TRequest="SecOCKey.Request_SupplierKeyProvisioning_Result" TResponse="SecOCKey.Response_SupplierKeyProvisioning_Result" Method="PUT" Url="@($"{ApiAddress}/kms/SecOCKey/SupplierKeyProvisioning")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeySyncValue" TRequest="SecOCKey.Request_SupplierKeySyncValue" TResponse="SecOCKey.Response_SupplierKeySyncValue" Method="POST" Url="@($"{ApiAddress}/kms/SecOCKey/SupplierKeySyncValue")">
</ProxyKmsModule>
<br />
<ProxyKmsModule Title="SupplierKeySyncValue" TRequest="SecOCKey.Request_SupplierKeySyncValue_Result" TResponse="SecOCKey.Response_SupplierKeySyncValue_Result" Method="PUT" Url="@($"{ApiAddress}/kms/SecOCKey/SupplierKeySyncValue")">
</ProxyKmsModule>
</RadzenFieldset>
</div>
@code {
public string ApiAddress { get; set; }
protected override async Task OnInitializedAsync()
{
var findApi = _configService.GetConfig().Api.Find(x => x.Id == 2);
if(findApi is not null)
{
ApiAddress = findApi.Host;
}
}
}

View File

@ -0,0 +1,75 @@
@using Newtonsoft.Json
@using Radzen.Blazor
@using Web.Operation.Services
@typeparam TRequest where TRequest : class, new()
@typeparam TResponse where TResponse : class, new()
@inject ProxyKMSService _proxyKmsService
<div>
<RadzenLabel Style="color: #bb86fc">@Title</RadzenLabel>
<div>
<div style="display:flex;">
<div style="width:50%; margin: 1rem;">
<div style="margin-bottom: 0.5rem; display:flex; justify-content:center; align-items:center; font-size: 1.6rem;">
<RadzenLabel>Request</RadzenLabel>
<RadzenLabel Style="margin-left: 2rem;">@($"[{Method}]")</RadzenLabel>
<RadzenTextBox Style="margin-left:1rem; width:100%;" @bind-Value="@Url"></RadzenTextBox>
<RadzenButton Style="margin-left: 2rem; width: 10rem;" Click="@OnClickSend">Send</RadzenButton>
</div>
<div>
<RadzenTextArea Style="width:100%; height: 20rem; font-size: 1.6rem;" @bind-Value="@Request"></RadzenTextArea>
</div>
</div>
<div style="width:50%; margin:1rem; font-size: 1.6rem;">
<div style="margin-bottom:0.5rem;">
<RadzenLabel>Response</RadzenLabel>
</div>
<div>
<RadzenTextArea Style="width:100%; height: 20rem; font-size: 1.6rem;" @bind-Value="@Response"></RadzenTextArea>
</div>
</div>
</div>
</div>
</div>
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public string Method { get; set; }
[Parameter]
public string Url { get; set; }
public string Request{ get; set; }
public string Response{ get; set; }
protected override async Task OnInitializedAsync()
{
var request = new TRequest();
Request = request.ToJson();
}
private async Task OnClickSend()
{
var req = JsonConvert.DeserializeObject<TRequest>(Request);
TResponse res = new TResponse();
if(Method.ToLower() == "post")
{
res = await _proxyKmsService.PostKms<TRequest, TResponse>($"{Url}", req);
}
else if(Method.ToLower() == "put")
{
res = await _proxyKmsService.PutKms<TRequest, TResponse>($"{Url}", req);
}
Response = res.ToJson();
}
}

View File

@ -0,0 +1,213 @@
namespace Web.Operation.Packet
{
//1. EcuID
public class EcuID
{
public class Request_SupplierEcuID
{
public string EcuType { get; set; } = string.Empty;
public string Phase { get; set; } = string.Empty;
public string SupplierID { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string Serial { get; set; } = string.Empty;
}
public class Response_SupplierEcuID : Response_Common
{
}
}
//2. MasterECUKey
public class MasterEcuKey
{
public class Request_SupplierKeyProvisioning
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string KeyID { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning : Response_Common
{
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record
public class SupplierKeyProvisioningRecords
{
public string KeyID { get; set; } = string.Empty;
public string M1 { get; set; } = string.Empty;
public string M2 { get; set; } = string.Empty;
public string M3 { get; set; } = string.Empty;
public string M4 { get; set; } = string.Empty;
public string M5 { get; set; } = string.Empty;
}
#endregion
}
//
public class Request_SupplierKeyProvisioning_Result
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
public string ResultStatus { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning_Result : Response_Common
{
}
}
//3. SupplierSymmKey
public class SupplierSymmKey
{
public class Request_SupplierKeyProvisioning
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string KeyID { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning : Response_Common
{
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record
public class SupplierKeyProvisioningRecords
{
public string M1 { get; set; } = string.Empty;
public string M2 { get; set; } = string.Empty;
public string M3 { get; set; } = string.Empty;
public string M4 { get; set; } = string.Empty;
public string M5 { get; set; } = string.Empty;
}
#endregion
}
//
public class Request_SupplierKeyProvisioning_Result
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
public string ResultStatus { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning_Result : Response_Common
{
}
//
public class Request_SupplierKeySyncValue
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
}
public class Response_SupplierKeySyncValue : Response_Common
{
public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
#region record
public class SupplierKeySyncValueRecords
{
public string KeyID { get; set; } = string.Empty;
public string KeySyncValue { get; set; } = string.Empty;
public string Challenge { get; set; } = string.Empty;
}
#endregion
}
//
public class Request_SupplierKeySyncValue_Result
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
public string ResultStatus { get; set; } = string.Empty;
}
public class Response_SupplierKeySyncValue_Result : Response_Common
{
}
}
//4. SecOCKey
public class SecOCKey
{
public class Request_SupplierKeyProvisioning
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string KeyID { get; set; } = string.Empty;
public string SupplierSecretKey { get; set; } = string.Empty;
public string Counter { get; set; } = string.Empty;
public string Challenge { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning : Response_Common
{
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
#region record
public class SupplierKeyProvisioningRecords
{
public string KeyID { get; set; } = string.Empty;
public string M1 { get; set; } = string.Empty;
public string M2 { get; set; } = string.Empty;
public string M3 { get; set; } = string.Empty;
public string M4 { get; set; } = string.Empty;
public string M5 { get; set; } = string.Empty;
}
#endregion
}
//
public class Request_SupplierKeyProvisioning_Result
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string KeyID { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
public string ResultStatus { get; set; } = string.Empty;
}
public class Response_SupplierKeyProvisioning_Result : Response_Common
{
}
//
public class Request_SupplierKeySyncValue
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
}
public class Response_SupplierKeySyncValue : Response_Common
{
public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
#region record
public class SupplierKeySyncValueRecords
{
public string KeyID { get; set; } = string.Empty;
public string KeySyncValue { get; set; } = string.Empty;
public string Challenge { get; set; } = string.Empty;
}
#endregion
}
//
public class Request_SupplierKeySyncValue_Result
{
public string ProvisioningType { get; set; } = string.Empty;
public string EcuID { get; set; } = string.Empty;
public string KeyID { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
public string ResultStatus { get; set; } = string.Empty;
}
public class Response_SupplierKeySyncValue_Result : Response_Common
{
}
}
#region common
public class Response_Common
{
public string ResultStatus { get; set; } = string.Empty;
public string ResultReason { get; set; } = string.Empty;
public string ResultMessage { get; set; } = string.Empty;
}
#endregion
}

View File

@ -34,6 +34,7 @@ builder.Services.AddSingleton<ConfigService<WebClientConfig>>();
//scoped //scoped
builder.Services.AddScoped<PopupService>(); builder.Services.AddScoped<PopupService>();
builder.Services.AddScoped<CPMetaService>(); builder.Services.AddScoped<CPMetaService>();
builder.Services.AddScoped<ProxyKMSService>();
//db //db
builder.Services.AddSingleton<DbContextProvider>(); // Generic <20><><EFBFBD><EFBFBD> builder.Services.AddSingleton<DbContextProvider>(); // Generic <20><><EFBFBD><EFBFBD>

View File

@ -0,0 +1,39 @@
using SystemX.Core.Communication;
using SystemX.Core.Services;
using Web.Operation.Packet;
using WebClient.Library.Config;
namespace Web.Operation.Services
{
public class ProxyKMSService
{
private readonly IServiceScopeFactory _scopeFactory;
private readonly ConfigService<WebClientConfig>? _configService;
private string ApiHost = string.Empty;
public ProxyKMSService(IServiceProvider serviceProvider, IServiceScopeFactory scopeFactory, ConfigService<WebClientConfig> configService)
{
_scopeFactory = scopeFactory;
_configService = configService;
}
public async Task<RESPONSE> PostKms<REQUEST,RESPONSE>(string url, REQUEST request) where REQUEST : class where RESPONSE : class
{
Http http = new Http();
var res = await http.PostJsonAsync<REQUEST,RESPONSE>($"{url}", request);
return res;
}
public async Task<RESPONSE> PutKms<REQUEST, RESPONSE>(string url, REQUEST request) where REQUEST : class where RESPONSE : class
{
Http http = new Http();
var res = await http.PutJsonAsync<REQUEST, RESPONSE>($"{url}", request);
return res;
}
}
}

View File

@ -96,6 +96,15 @@ h1:focus {
font-size: 1.5rem !important; font-size: 1.5rem !important;
} }
.rz-fieldset-legend-text{
font-size: 1.6rem !important;
color:darkorange;
}
.rz-fieldset{
border-color: darkorange !important;
}
/*common*/ /*common*/
span { span {
font-size: 1.5rem; font-size: 1.5rem;