260707_01_ENH: pkey 암호화, short url 생성에 api키 적용
This commit is contained in:
@@ -16,13 +16,22 @@ namespace REPORT_API_ver6.Controllers
|
|||||||
|
|
||||||
[Route("pkey")]
|
[Route("pkey")]
|
||||||
[HttpGet]
|
[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();
|
HttpContextAccessor hcAccessor = new HttpContextAccessor();
|
||||||
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
||||||
|
|
||||||
UserInfo userInfo = Security.ValidateToken(token);
|
var configuration = Common.GetConfiguration();
|
||||||
if (userInfo != null)
|
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();
|
Project project = new Project();
|
||||||
if (project.getProjectInfo(pkey, Convert.ToInt32(iskiwi)).Rows.Count > 0)
|
if (project.getProjectInfo(pkey, Convert.ToInt32(iskiwi)).Rows.Count > 0)
|
||||||
|
|||||||
@@ -18,19 +18,32 @@ namespace REPORT_API_ver6.Controllers
|
|||||||
|
|
||||||
[Route("short")]
|
[Route("short")]
|
||||||
[HttpPost]
|
[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();
|
HttpContextAccessor hcAccessor = new HttpContextAccessor();
|
||||||
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
hcAccessor.HttpContext.Response.ContentType = "text/plain";
|
||||||
|
|
||||||
UserInfo userInfo = Security.ValidateToken(token);
|
var configuration = Common.GetConfiguration();
|
||||||
if (userInfo != null)
|
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";
|
string okey = "REPORT";
|
||||||
if(userInfo.ID == "KON" || userInfo.ID == "KIWI" || userInfo.ID == "NEWSSAK")
|
if(userInfo.ID == "KON" || userInfo.ID == "KIWI" || userInfo.ID == "NEWSSAK")
|
||||||
{
|
{
|
||||||
okey = userInfo.ID;
|
okey = userInfo.ID;
|
||||||
}
|
}
|
||||||
|
else if(!String.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
okey = value;
|
||||||
|
}
|
||||||
|
|
||||||
PkeyInfo pkeyInfo = new PkeyInfo(skey);
|
PkeyInfo pkeyInfo = new PkeyInfo(skey);
|
||||||
Project project = new Project();
|
Project project = new Project();
|
||||||
|
|||||||
13
REPORT_API_ver6/Enums/SortDirection.cs
Normal file
13
REPORT_API_ver6/Enums/SortDirection.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum SortDirection
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "asc")]
|
||||||
|
Asc,
|
||||||
|
|
||||||
|
[EnumMember(Value = "desc")]
|
||||||
|
Desc
|
||||||
|
}
|
||||||
@@ -13,3 +13,24 @@ public class DataTabelToExcelSheet
|
|||||||
}
|
}
|
||||||
public DataTabelToExcelSheet() { }
|
public DataTabelToExcelSheet() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PageRequest
|
||||||
|
{
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
public int PageSize { get; set; }
|
||||||
|
public string SortBy {get; set; } = string.Empty;
|
||||||
|
public SortDirection SortDir { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PageResponseDto<T>
|
||||||
|
{
|
||||||
|
public List<T> Content { get; set; } = new List<T>();
|
||||||
|
public int TotalElements { get; set; }
|
||||||
|
public int TotalPages { get; set; }
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
public int PageSize { get; set; }
|
||||||
|
public int NumberOfElements { get; set; }
|
||||||
|
public bool First { get; set; }
|
||||||
|
public bool Last { get; set; }
|
||||||
|
public bool Empty { get; set; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user