diff --git a/REPORT_API_ver6/Controllers/SecurityAPI.cs b/REPORT_API_ver6/Controllers/SecurityAPI.cs index 540bbe4..3e62297 100644 --- a/REPORT_API_ver6/Controllers/SecurityAPI.cs +++ b/REPORT_API_ver6/Controllers/SecurityAPI.cs @@ -12,7 +12,7 @@ namespace REPORT_API_ver6.Controllers [ApiController] public class SecurityAPI : ControllerBase { - private static readonly List externalList = new() {"KON", "KIWI", "CLIENT"}; + private static readonly List ExternalList = new() {"KON", "KIWI", "CLIENT"}; [Route("pkey")] [HttpGet] @@ -127,8 +127,20 @@ namespace REPORT_API_ver6.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에서 조회 + User user = new User(); + isKricExternal = user.isKricSystem(externalParam.External); + } - if (externalParam.External.StartsWith("KRIC_SYS_") || externalList.Contains(externalParam.External)) + if (isKricExternal) { string returnString = ""; Log.insertLoginLog(externalParam.External); diff --git a/REPORT_API_ver6/Services/User.cs b/REPORT_API_ver6/Services/User.cs index 7548e16..c7d5d56 100644 --- a/REPORT_API_ver6/Services/User.cs +++ b/REPORT_API_ver6/Services/User.cs @@ -40,6 +40,29 @@ namespace REPORT_API_ver6.Services return resultTable; } + public bool isKricSystem(string systemString) + { + bool isKricSystem = false; + + DAL dal = new DAL(); + 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 getDinIDs() { string returnString = string.Empty;