260707_01_ENH: pkey 암호화, short url 생성에 api키 적용
This commit is contained in:
@@ -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