diff --git a/KART_API/Controllers/SecurityController.cs b/KART_API/Controllers/SecurityController.cs index 795212b..8f9f341 100644 --- a/KART_API/Controllers/SecurityController.cs +++ b/KART_API/Controllers/SecurityController.cs @@ -13,7 +13,7 @@ namespace KART_API.Controllers [ApiController] public class SecurityController : ControllerBase { - private static readonly List externalList = new() {"NS", "KON", "KIWI", "CLIENT"}; + private static readonly List ExternalList = new() {"NS", "KON", "KIWI", "CLIENT"}; [Route("pkey")]//확인 [HttpGet] @@ -122,8 +122,20 @@ namespace KART_API.Controllers { HttpContextAccessor hcAccessor = new HttpContextAccessor(); hcAccessor.HttpContext.Response.ContentType = "text/plain"; + + bool isKricExternal = false; + if (ExternalList.Contains(externalParam.External)) + { + isKricExternal = true; + } + else if (externalParam.External.StartsWith("PRJCT_") || externalParam.External.StartsWith("KRIC_SYS_")) + { + //PRJCT_, KRIC_SYS_ 인 경우 db에서 조회 + UserService user = new UserService(); + isKricExternal = user.isKricSystem(externalParam.External); + } - if (externalParam.External.StartsWith("KRIC_SYS_") || externalList.Contains(externalParam.External)) + if (isKricExternal) { string returnString = ""; LogService.insertLoginLog(externalParam.External); diff --git a/KART_API/Services/UserService.cs b/KART_API/Services/UserService.cs index 6bb5aa6..93ef26c 100644 --- a/KART_API/Services/UserService.cs +++ b/KART_API/Services/UserService.cs @@ -41,6 +41,29 @@ namespace KART_API.Services return resultTable; } + + public bool isKricSystem(string systemString) + { + bool isKricSystem = false; + + MSDAL dal = new MSDAL(); + var connection = dal.ConnectReport(); + try + { + DataTable resultTable = dal.GetDataTable($"SELECT * FROM REPORT_EXTERNAL_SYS WHERE system_key = '{systemString}' and is_use = 1", connection); + isKricSystem = resultTable.Rows.Count > 0; + } + catch (Exception ex) + { + logger.Fatal(this.GetType().Name + " > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message); + } + finally + { + dal.Disconnect(connection); + } + + return isKricSystem; + } public static string userNumber(string userEmail) {