Files
2026-02-02 10:14:43 +09:00

170 lines
9.4 KiB
C#

using Microsoft.AspNetCore.Mvc;
using SystemX.Core.Controller;
using WebApi.Project.ProxyKMS.Models;
using WebApi.Project.ProxyKMS.Services;
namespace WebApi.Project.ProxyKMS.Controllers
{
[ApiController]
[Route("[controller]")]
public class KmsController : CommonController<ProxyKMSConfig>
{
private readonly KmsService _kmsMetaService;
public KmsController(IServiceProvider serviceProvider, IHttpContextAccessor httpContextAccessor, KmsService kmsService)
: base(serviceProvider, httpContextAccessor)
{
_kmsMetaService = kmsService;
}
//1. EcuID
[HttpPost("EcuID/SupplierEcuID")]
public async Task<IResult> EcuID_SupplierEcuID([FromBody] EcuID.Request_SupplierEcuID request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<EcuID.Request_SupplierEcuID, EcuID.Response_SupplierEcuID>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
//2. MasterECUKEy
[HttpPost("MasterEcuKey/SupplierKeyProvisioning")]
public async Task<IResult> MasterEcuKey_SupplierKeyProvisioning([FromBody] MasterEcuKey.Request_SupplierKeyProvisioning request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<MasterEcuKey.Request_SupplierKeyProvisioning, MasterEcuKey.Response_SupplierKeyProvisioning>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPut("MasterEcuKey/SupplierKeyProvisioning")]
public async Task<IResult> MasterEcuKey_SupplierKeyProvisioningResult([FromBody] MasterEcuKey.Request_SupplierKeyProvisioning_Result request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PutKms<MasterEcuKey.Request_SupplierKeyProvisioning_Result, MasterEcuKey.Response_SupplierKeyProvisioning_Result>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
//3. SupplierSymmKey
[HttpPost("SupplierSymmKey/SupplierKeyProvisioning")]
public async Task<IResult> SupplierSymmKey_SupplierKeyProvisioning([FromBody] SupplierSymmKey.Request_SupplierKeyProvisioning request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<SupplierSymmKey.Request_SupplierKeyProvisioning, SupplierSymmKey.Response_SupplierKeyProvisioning>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPut("SupplierSymmKey/SupplierKeyProvisioning")]
public async Task<IResult> SupplierSymmKey_SupplierKeyProvisioningResult([FromBody] SupplierSymmKey.Request_SupplierKeyProvisioning_Result request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PutKms<SupplierSymmKey.Request_SupplierKeyProvisioning_Result, SupplierSymmKey.Response_SupplierKeyProvisioning_Result>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPost("SupplierSymmKey/SupplierKeySyncValue")]
public async Task<IResult> SupplierSymmKey_SupplierKeySyncValue([FromBody] SupplierSymmKey.Request_SupplierKeySyncValue request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<SupplierSymmKey.Request_SupplierKeySyncValue, SupplierSymmKey.Response_SupplierKeySyncValue>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPut("SupplierSymmKey/SupplierKeySyncValue")]
public async Task<IResult> SupplierSymmKey_SupplierKeySyncValueResult([FromBody] SupplierSymmKey.Request_SupplierKeySyncValue_Result request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PutKms<SupplierSymmKey.Request_SupplierKeySyncValue_Result, SupplierSymmKey.Response_SupplierKeySyncValue_Result>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
//4,SecOCKey
[HttpPost("SecOCKey/SupplierKeyProvisioning")]
public async Task<IResult> SecOCKey_SupplierKeyProvisioning([FromBody] SecOCKey.Request_SupplierKeyProvisioning request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<SecOCKey.Request_SupplierKeyProvisioning, SecOCKey.Response_SupplierKeyProvisioning>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPut("SecOCKey/SupplierKeyProvisioning")]
public async Task<IResult> SecOCKey_SupplierKeyProvisioningResult([FromBody] SecOCKey.Request_SupplierKeyProvisioning_Result request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PutKms<SecOCKey.Request_SupplierKeyProvisioning_Result, SecOCKey.Response_SupplierKeyProvisioning_Result>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPost("SecOCKey/SupplierKeySyncValue")]
public async Task<IResult> SecOCKey_SupplierKeySyncValue([FromBody] SecOCKey.Request_SupplierKeySyncValue request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PostKms<SecOCKey.Request_SupplierKeySyncValue, SecOCKey.Request_SupplierKeySyncValue>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
[HttpPut("SecOCKey/SupplierKeySyncValue")]
public async Task<IResult> SecOCKey_SupplierKeySyncValueResult([FromBody] SecOCKey.Request_SupplierKeySyncValue_Result request)
{
Guid guid = Guid.NewGuid();
LogXnet.WriteLine($"[Request][{GetRequestMethod()}:{GetMethodName()}][Client IP:{GetClientIP()}][RequestUrl:{GetRequestUrl()}]::({guid}){Environment.NewLine} {request.ToJson()}", LogXLabel.CONTROLLER);
var response = await _kmsMetaService.PutKms<SecOCKey.Request_SupplierKeySyncValue_Result, SecOCKey.Response_SupplierKeySyncValue_Result>(request, guid.ToString());
LogXnet.WriteLine($"[Response]::({guid}){Environment.NewLine} {response.ToJson()}", LogXLabel.CONTROLLER);
return Results.Ok(response);
}
}
}