260707_01_ENH: pkey 암호화, short url 생성에 api키 적용
This commit is contained in:
@@ -16,13 +16,22 @@ namespace REPORT_API_ver6.Controllers
|
||||
|
||||
[Route("pkey")]
|
||||
[HttpGet]
|
||||
public IActionResult EncryptString([FromHeader] string token, [FromHeader]string pkey, [FromHeader]string iskiwi)
|
||||
public IActionResult EncryptString
|
||||
(
|
||||
[FromHeader(Name = "token")] string? token,
|
||||
[FromHeader(Name = "X-API-Key")] string? xApiKey,
|
||||
[FromHeader]string pkey,
|
||||
[FromHeader]string iskiwi
|
||||
)
|
||||
{
|
||||
HttpContextAccessor hcAccessor = new HttpContextAccessor();
|
||||
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
||||
|
||||
UserInfo userInfo = Security.ValidateToken(token);
|
||||
if (userInfo != null)
|
||||
|
||||
var configuration = Common.GetConfiguration();
|
||||
var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""];
|
||||
UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token);
|
||||
|
||||
if (userInfo != null || !String.IsNullOrEmpty(value))
|
||||
{
|
||||
Project project = new Project();
|
||||
if (project.getProjectInfo(pkey, Convert.ToInt32(iskiwi)).Rows.Count > 0)
|
||||
@@ -35,7 +44,7 @@ namespace REPORT_API_ver6.Controllers
|
||||
pkey = "|K|W|" + pkey;
|
||||
}
|
||||
returnString = WebUtility.UrlEncode(security.encryptString(pkey));
|
||||
|
||||
|
||||
Response.StatusCode = (int)HttpStatusCode.OK;
|
||||
return Content(returnString);
|
||||
}
|
||||
|
||||
@@ -18,19 +18,32 @@ namespace REPORT_API_ver6.Controllers
|
||||
|
||||
[Route("short")]
|
||||
[HttpPost]
|
||||
public IActionResult ShortURL([FromHeader] string token, [FromBody] ShortURLParam shortURLParam, [FromHeader] string skey)
|
||||
public IActionResult ShortURL
|
||||
(
|
||||
[FromHeader(Name = "token")] string? token,
|
||||
[FromHeader(Name = "X-API-Key")] string? xApiKey,
|
||||
[FromHeader] string skey,
|
||||
[FromBody] ShortURLParam shortURLParam
|
||||
)
|
||||
{
|
||||
HttpContextAccessor hcAccessor = new HttpContextAccessor();
|
||||
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
||||
|
||||
UserInfo userInfo = Security.ValidateToken(token);
|
||||
if (userInfo != null)
|
||||
var configuration = Common.GetConfiguration();
|
||||
var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""];
|
||||
UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token);
|
||||
|
||||
if (userInfo != null || !String.IsNullOrEmpty(value))
|
||||
{
|
||||
string okey = "REPORT";
|
||||
if(userInfo.ID == "KON" || userInfo.ID == "KIWI" || userInfo.ID == "NEWSSAK")
|
||||
{
|
||||
okey = userInfo.ID;
|
||||
}
|
||||
else if(!String.IsNullOrEmpty(value))
|
||||
{
|
||||
okey = value;
|
||||
}
|
||||
|
||||
PkeyInfo pkeyInfo = new PkeyInfo(skey);
|
||||
Project project = new Project();
|
||||
|
||||
Reference in New Issue
Block a user