update 20241003
This commit is contained in:
@@ -231,12 +231,14 @@
|
||||
<Compile Include="Controllers\DocumentController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\ArchivController.cs" />
|
||||
<Compile Include="Controllers\TokenController.cs" />
|
||||
<Compile Include="Controllers\UnterschriftController.cs" />
|
||||
<Compile Include="Controllers\ValuesController.cs" />
|
||||
<Compile Include="Controllers\AntwortAdressController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\StaticParams.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Startup.cs" />
|
||||
</ItemGroup>
|
||||
@@ -309,7 +311,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Views\Unterschrift\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common</Controller_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
|
||||
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
||||
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Database;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using API_NetFramework.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
@@ -15,6 +16,7 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class AntwortAdresseController : ApiController
|
||||
{
|
||||
string tokenfunction = "Adresse";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
/// <summary>
|
||||
/// GetGetAll liefert alle GAS-Adressen
|
||||
@@ -27,7 +29,10 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetGetAll(string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) ==false){
|
||||
//string a = SecuringWebApiUsingApiKey.Middleware.StringCipher.Encrypt("Adresse", "OnDoc");
|
||||
//a = SecuringWebApiUsingApiKey.Middleware.StringCipher.Decrypt(a, "OnDoc");
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request,tokenfunction) ==false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
@@ -39,7 +44,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request,e.Message,LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -54,7 +63,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetByID(string ID,string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -67,7 +76,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +95,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByTGNummer(string tgnummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -95,7 +108,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetAllMitarbeiterByMitarbeiterNr")]
|
||||
@@ -109,7 +126,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByMitarbeiterNr(string Mitarbeiternr, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -122,7 +139,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +159,8 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -151,7 +173,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetMitarbeiterUndStandard")]
|
||||
@@ -165,7 +191,7 @@ namespace API_NetFramework.Controllers
|
||||
/// public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
public IHttpActionResult GetGASAdressen_Einzeilig(string TGNummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -185,7 +211,12 @@ namespace API_NetFramework.Controllers
|
||||
return Content(HttpStatusCode.OK, db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
};
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace API_NetFramework.Controllers
|
||||
public class ArchivController : ApiController
|
||||
{
|
||||
// GET: OnBase
|
||||
|
||||
string tokenfunction = "Archiv";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
/// <summary>
|
||||
/// Archiviert das Dokument aus OnDoc in OnBase
|
||||
@@ -35,12 +36,19 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult ArchivDoc_From_Database(string DokumentID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -57,12 +65,19 @@ namespace API_NetFramework.Controllers
|
||||
/// <remarks></remarks>
|
||||
public IHttpActionResult ArchivDocBase64(string Dokument, string Dokumenttyp)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// CheckDocID prüft auf eine vorhandene DokumentID in OnDoc (DokumentID OFFEDK... / Barcode-Klenber-Nr)
|
||||
@@ -77,7 +92,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult CheckDocID(string DokumentID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -96,14 +111,33 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
return Content(HttpStatusCode.NotFound, DokumentID);
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/ArchivDocFromIRIS")]
|
||||
public IHttpActionResult ArchivDocFromIRIS(string dokumentid)
|
||||
{
|
||||
return Ok();
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -20,16 +22,29 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
public class DocumentController : ApiController
|
||||
{
|
||||
|
||||
public string tokenfunction = "Dokument";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
[HttpGet]
|
||||
[Route("API/GetDocument")]
|
||||
public IHttpActionResult GetDocument(string dokid)
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDoc(dokid);
|
||||
return Ok(dok);
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDoc(dokid);
|
||||
return Ok(dok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object pageCollection { get; set; }
|
||||
@@ -47,95 +62,136 @@ namespace API_NetFramework.Controllers
|
||||
[HttpGet]
|
||||
public IHttpActionResult GetDocumentPDF(string dokid)
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDocAsPDF(dokid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
return Ok(dok);
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDocAsPDF(dokid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
return Ok(dok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/SendToOnBase")]
|
||||
public IHttpActionResult SendToOnBase(string dokid)
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select * from dokument where dokumentid='" + dokid + "'",false,true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count < 1) {
|
||||
db = null;
|
||||
return BadRequest("Dokument " + dokid + " not found");
|
||||
}
|
||||
else
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='"+dokid + "'");
|
||||
db = null;
|
||||
return Ok("Archivierung ausgelöst");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select * from dokument where dokumentid='" + dokid + "'", false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count < 1)
|
||||
{
|
||||
db = null;
|
||||
return BadRequest("Dokument " + dokid + " not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='" + dokid + "'");
|
||||
db = null;
|
||||
return Ok("Archivierung ausgelöst");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/GenDoc")]
|
||||
public IHttpActionResult GenDoc(string Partnernr, String Dokumenttypnr, string TGCreator="", string TGResp="", string TGUL="", string TGUR="", string Faksimile="", string FoU="", string PrintLogo="")
|
||||
{
|
||||
if (!(ParamCheck("partnernr",Partnernr))) { return BadRequest("Partnernr " + Partnernr + " ist ungültig"); }
|
||||
if (!(ParamCheck("dokumenttyp", Dokumenttypnr))) { return BadRequest("Dokumenttyp " + Dokumenttypnr + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgcreator", TGCreator))) { return BadRequest("TGCreator " + TGCreator + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgresp", TGResp))) { return BadRequest("TGResp " + TGResp + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUL))) { return BadRequest("TG Unterschrift links " + TGUL + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUR))) { return BadRequest("TG Unterschrift rechts " + TGUR + " ist ungültig"); }
|
||||
if (!(ParamCheck("faksimile", Faksimile))) { return BadRequest("Parameter Faxsimile " + Faksimile + " ist ungültig"); }
|
||||
if (!(ParamCheck("formohneunterschrift", FoU))) { return BadRequest("Parameter Form ohne Unterschrift " + FoU + " ist ungültig"); }
|
||||
if (!(ParamCheck("printlogo", PrintLogo))) { return BadRequest("Parameter PrintLogo " + PrintLogo + " ist ungültig"); }
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!(ParamCheck("partnernr", Partnernr))) { return BadRequest("Partnernr " + Partnernr + " ist ungültig"); }
|
||||
if (!(ParamCheck("dokumenttyp", Dokumenttypnr))) { return BadRequest("Dokumenttyp " + Dokumenttypnr + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgcreator", TGCreator))) { return BadRequest("TGCreator " + TGCreator + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgresp", TGResp))) { return BadRequest("TGResp " + TGResp + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUL))) { return BadRequest("TG Unterschrift links " + TGUL + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUR))) { return BadRequest("TG Unterschrift rechts " + TGUR + " ist ungültig"); }
|
||||
if (!(ParamCheck("faksimile", Faksimile))) { return BadRequest("Parameter Faxsimile " + Faksimile + " ist ungültig"); }
|
||||
if (!(ParamCheck("formohneunterschrift", FoU))) { return BadRequest("Parameter Form ohne Unterschrift " + FoU + " ist ungültig"); }
|
||||
if (!(ParamCheck("printlogo", PrintLogo))) { return BadRequest("Parameter PrintLogo " + PrintLogo + " ist ungültig"); }
|
||||
|
||||
Database.DB db = new DB(connectionstring);
|
||||
Model.clsdocgendata docgendata = new Model.clsdocgendata();
|
||||
|
||||
docgendata.partnernr = Partnernr;
|
||||
docgendata.inhaberadresse = "";
|
||||
docgendata.zustelladresse = "";
|
||||
docgendata.dokumenttypnr = Dokumenttypnr;
|
||||
docgendata.unterschriftLinks = db.Get_Mitarbeiternr(TGUL).ToString();
|
||||
docgendata.unterschriftRehts = db.Get_Mitarbeiternr(TGUR).ToString();
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.ersteller = db.Get_Mitarbeiternr(TGCreator).ToString();
|
||||
docgendata.team = db.Get_Teamnr(docgendata.ersteller).ToString();
|
||||
docgendata.digitaleunterschrift = false;
|
||||
docgendata.frormularOhneUnterschrift = false;
|
||||
//docgendata.team = "";
|
||||
docgendata.zustaendigkube = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.status = "-1";
|
||||
docgendata.dokumentdatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
docgendata.bezeichnung = "";
|
||||
docgendata.erstellungsart= Erstellungsart.DokumentAlsPDF;
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
if (docgendata.verantwortlich=="0") { docgendata.verantwortlich = docgendata.ersteller; }
|
||||
Database.DB db = new DB(connectionstring);
|
||||
Model.clsdocgendata docgendata = new Model.clsdocgendata();
|
||||
|
||||
clsDocData dokdata = new clsDocData();
|
||||
dokdata.PartnerNr = docgendata.partnernr;
|
||||
dokdata.UseEDOKA_Values = "True";
|
||||
dokdata.DokumenttypNr = docgendata.dokumenttypnr;
|
||||
dokdata.Unterschrift_Links = docgendata.unterschriftLinks;
|
||||
dokdata.Unterschrift_Rechts = docgendata.unterschriftRehts;
|
||||
dokdata.Verantwortlich = docgendata.verantwortlich;
|
||||
dokdata.Team = docgendata.team;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Status = docgendata.status;
|
||||
dokdata.Ersteller = docgendata.ersteller;
|
||||
dokdata.DokumentDatum = docgendata.dokumentdatum;
|
||||
dokdata.Bezeichnung = docgendata.bezeichnung;
|
||||
if (PrintLogo == "Yes") { dokdata.PrintLogo=true; }else { dokdata.PrintLogo=false; }
|
||||
if (docgendata.erstellungsart == Erstellungsart.DokumentAlsPDF) { dokdata.Result_as_PDF = "True"; } else { dokdata.Result_as_PDF = "False"; }
|
||||
if (docgendata.digitaleunterschrift == true) { dokdata.As_Faksimile = "True"; } else { dokdata.As_Faksimile = "False"; }
|
||||
|
||||
string dokumentid = "";
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata);
|
||||
docgendata.partnernr = Partnernr;
|
||||
docgendata.inhaberadresse = "";
|
||||
docgendata.zustelladresse = "";
|
||||
docgendata.dokumenttypnr = Dokumenttypnr;
|
||||
docgendata.unterschriftLinks = db.Get_Mitarbeiternr(TGUL).ToString();
|
||||
docgendata.unterschriftRehts = db.Get_Mitarbeiternr(TGUR).ToString();
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.ersteller = db.Get_Mitarbeiternr(TGCreator).ToString();
|
||||
docgendata.team = db.Get_Teamnr(docgendata.ersteller).ToString();
|
||||
docgendata.digitaleunterschrift = false;
|
||||
docgendata.frormularOhneUnterschrift = false;
|
||||
//docgendata.team = "";
|
||||
docgendata.zustaendigkube = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.status = "-1";
|
||||
docgendata.dokumentdatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
docgendata.bezeichnung = "";
|
||||
docgendata.erstellungsart = Erstellungsart.DokumentAlsPDF;
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
if (docgendata.verantwortlich == "0") { docgendata.verantwortlich = docgendata.ersteller; }
|
||||
|
||||
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(this.connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
return Ok(dokumentid);
|
||||
clsDocData dokdata = new clsDocData();
|
||||
dokdata.PartnerNr = docgendata.partnernr;
|
||||
dokdata.UseEDOKA_Values = "True";
|
||||
dokdata.DokumenttypNr = docgendata.dokumenttypnr;
|
||||
dokdata.Unterschrift_Links = docgendata.unterschriftLinks;
|
||||
dokdata.Unterschrift_Rechts = docgendata.unterschriftRehts;
|
||||
dokdata.Verantwortlich = docgendata.verantwortlich;
|
||||
dokdata.Team = docgendata.team;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Status = docgendata.status;
|
||||
dokdata.Ersteller = docgendata.ersteller;
|
||||
dokdata.DokumentDatum = docgendata.dokumentdatum;
|
||||
dokdata.Bezeichnung = docgendata.bezeichnung;
|
||||
if (PrintLogo == "Yes") { dokdata.PrintLogo = true; } else { dokdata.PrintLogo = false; }
|
||||
if (docgendata.erstellungsart == Erstellungsart.DokumentAlsPDF) { dokdata.Result_as_PDF = "True"; } else { dokdata.Result_as_PDF = "False"; }
|
||||
if (docgendata.digitaleunterschrift == true) { dokdata.As_Faksimile = "True"; } else { dokdata.As_Faksimile = "False"; }
|
||||
|
||||
string dokumentid = "";
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata);
|
||||
|
||||
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(this.connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
return Ok(dokumentid);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private bool ParamCheck(string ParamType, string ParamValue)
|
||||
{
|
||||
|
||||
21
API_NetFramework/Controllers/TokenController.cs
Normal file
21
API_NetFramework/Controllers/TokenController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
public class TokenController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
[Route("API/Tokengenerator)")]
|
||||
|
||||
public IHttpActionResult TokenGenerator(string function, string pathphrase)
|
||||
{
|
||||
return Ok(SecuringWebApiUsingApiKey.Middleware.StringCipher.Encrypt (function, pathphrase));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,7 @@ using System.Net.Http.Headers;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
using API_NetFramework.Models;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -33,26 +32,41 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public class UnterschriftController : ApiController
|
||||
{
|
||||
|
||||
string tokenfunction = "Unterschrift";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64(string TGNummer)
|
||||
{
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
byte[] b = System.IO.File.ReadAllBytes(filename);
|
||||
return Ok(Convert.ToBase64String(b));
|
||||
} catch (Exception e) {
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
}
|
||||
try
|
||||
{
|
||||
byte[] b = System.IO.File.ReadAllBytes(filename);
|
||||
return Ok(Convert.ToBase64String(b));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -60,26 +74,37 @@ namespace API_NetFramework.Controllers
|
||||
[Route("API/GetUnterschrift")]
|
||||
public IHttpActionResult GetUnterschrift(string TGNummer)
|
||||
{
|
||||
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
var dataBytes = File.ReadAllBytes(@"x:\docdemo\unterschriften\kube.jpg");
|
||||
var dataStream = new MemoryStream(dataBytes);
|
||||
string imageName = TGNummer + ".jpg";
|
||||
return new unterschriftResult(dataStream, Request, imageName);
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
}
|
||||
try
|
||||
{
|
||||
var dataBytes = File.ReadAllBytes(@"x:\docdemo\unterschriften\kube.jpg");
|
||||
var dataStream = new MemoryStream(dataBytes);
|
||||
string imageName = TGNummer + ".jpg";
|
||||
return new unterschriftResult(dataStream, Request, imageName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Database;
|
||||
using API_NetFramework.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,6 +20,10 @@ namespace API_NetFramework
|
||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
APILogging.initLogging();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
61
API_NetFramework/Models/StaticParams.cs
Normal file
61
API_NetFramework/Models/StaticParams.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Configuration;
|
||||
using Database;
|
||||
using System.Net.Http;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace API_NetFramework.Models
|
||||
{
|
||||
public enum LogLevelType { Info, Warning, Trace, Debug, Error }
|
||||
public static class APILogging
|
||||
{
|
||||
|
||||
public static void initLogging()
|
||||
{
|
||||
if (Logging.Logging.IntLogLevel == "")
|
||||
{
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select * from nlog_parameter where id=3", false, true);
|
||||
Logging.Logging.IntLogLevel = db.dsdaten.Tables[0].Rows[0]["LogLevel"].ToString();
|
||||
Logging.Logging.IntUserID = db.dsdaten.Tables[0].Rows[0]["LogUserID"].ToString();
|
||||
db = null;
|
||||
}
|
||||
|
||||
}
|
||||
public static void Log(HttpRequestMessage request, string Message, LogLevelType logtype)
|
||||
{
|
||||
string userhost = "";
|
||||
if (request.Properties.ContainsKey("MS_HttpContext"))
|
||||
{
|
||||
userhost = ((HttpContextWrapper)request.Properties["MS_HttpContext"]).Request.UserHostAddress;
|
||||
}
|
||||
switch (logtype)
|
||||
{
|
||||
case LogLevelType.Info:
|
||||
Logging.Logging.Info(Message, request.RequestUri.ToString(), userhost);
|
||||
break;
|
||||
case LogLevelType.Warning:
|
||||
Logging.Logging.Warning(Message, request.RequestUri.ToString(), userhost);
|
||||
break;
|
||||
case LogLevelType.Trace:
|
||||
Logging.Logging.Trance(Message, request.RequestUri.ToString(), userhost);
|
||||
break;
|
||||
case LogLevelType.Debug:
|
||||
Logging.Logging.Debug(Message, request.RequestUri.ToString(), userhost);
|
||||
break;
|
||||
case LogLevelType.Error:
|
||||
Logging.Logging.Error(Message, request.RequestUri.ToString(), userhost);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ namespace OnDocAPI_NetFramework
|
||||
{
|
||||
var a = 1; ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="UnterschriftPath" value="x:\docdemo\unterschriften\" />
|
||||
<add key="Bearer" value ="abc"/>
|
||||
<add key="APIKeys" value="OnDocEHplewEWbuoNkOGCO1kvoxcHAzsXiJ9qbotaJosOf2zBV2AMlUkOeCsDjxWJrRPpQDRyP2WM83R8bNx7dI8u3A7Zqh1qGQQ7od0lmLNa6HdQv4epmaCytqJDTKu, OnDocFThMC91BXTDhKADoqmDV6yWiWpuSR8uEbhE92feD82jU3uWMeA5nDiAiBorQ5DYx9JFrnMT48wWmIiIQsRRMjjjGDwdGHNiyjufoYUG7dHEWVJ9THlfhZRyHkTy, OnDocqLLhcSJq30Kx2tl28CtBsMxhBMYYdV0vi4hrNOhIyzF3QrEOkiCNF2Fkt4lbVPYIjW6VeBButNniMVlIBozrFpE8NnD44N7cBVVmVKBAvE3xz5wg6oJH8RdRt0q, OnDocExHp86biVL9wTU8WFKWGJzKtOgIxx8NhS7Y4LwuYFsN1gIu3pzXKTf241Poimp9dEDmwflOzZ8svv5j7RJj4Y4vp4JkLic5tK9OsRELhZOxIZFkmHd6tlI8YDiI"/>
|
||||
<add key="APIKeys" value="U3AF12C/o+r8c1fhnk+NkEOduuH9uNH3aZ1AVb0dHN1fxMGLr1s0eKcvoeJ7bPY02ytHD4SjcFb78NiQQyvWtDD+S7noWCyNmaCQkXHMx4LAomlnvnwKPqVs1TQ0qFB+,5sPQAPCxiSj+JWf+sWKTYgdTRSXeZJX/Ft2wE5B/SaSPoxPNMvkTgNjbmiK18SNmJ66OPzOM1fEw70R+VZeRWU+5fowTIXAGYLDneikxmK4HnIJku8732xxJ/9EomCZ6"/>
|
||||
<add key="AuthCheck" value="Yes"/>
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
@@ -114,4 +114,9 @@
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
</handlers>
|
||||
</system.webServer></configuration>
|
||||
</system.webServer></configuration>
|
||||
|
||||
<!--APIKeys
|
||||
Adresse: U3AF12C/o+r8c1fhnk+NkEOduuH9uNH3aZ1AVb0dHN1fxMGLr1s0eKcvoeJ7bPY02ytHD4SjcFb78NiQQyvWtDD+S7noWCyNmaCQkXHMx4LAomlnvnwKPqVs1TQ0qFB+
|
||||
Archiv,Dokument,Unterschrift: 5sPQAPCxiSj+JWf+sWKTYgdTRSXeZJX/Ft2wE5B/SaSPoxPNMvkTgNjbmiK18SNmJ66OPzOM1fEw70R+VZeRWU+5fowTIXAGYLDneikxmK4HnIJku8732xxJ/9EomCZ6
|
||||
-->
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using API_NetFramework.Models;
|
||||
using Swashbuckle.Application;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -111,14 +112,21 @@ namespace SecuringWebApiUsingApiKey.Middleware
|
||||
public static class ApiKeyMiddleware
|
||||
{
|
||||
public static string[] apikeys;
|
||||
|
||||
|
||||
public static string GetValue( string key)
|
||||
{
|
||||
string res = WebConfigurationManager.AppSettings[key];
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Boolean Authorized(HttpRequestMessage request)
|
||||
private static bool checkfunction(string apikey, string function)
|
||||
{
|
||||
string decryptstring = SecuringWebApiUsingApiKey.Middleware.StringCipher.Decrypt(apikey, "OnDoc01");
|
||||
if ( decryptstring.Contains(function))
|
||||
{ return true; }
|
||||
else return false;
|
||||
}
|
||||
public static Boolean Authorized(HttpRequestMessage request, string function)
|
||||
{
|
||||
|
||||
if (GetValue("AuthCheck") == "Yes")
|
||||
@@ -126,25 +134,27 @@ namespace SecuringWebApiUsingApiKey.Middleware
|
||||
apikeys = GetValue("APIKeys").ToString().Split(',');
|
||||
IEnumerable<KeyValuePair<string, string>> queryParams = request.GetQueryNameValuePairs();
|
||||
var key = queryParams.FirstOrDefault(x => x.Key == "api_key");
|
||||
if (apikeys.Contains(key.Value)) { return true; }
|
||||
if (apikeys.Contains(key.Value) && checkfunction(key.Value,function)==true) { return true; }
|
||||
try
|
||||
{
|
||||
IEnumerable<string> headerValues = request.Headers.GetValues("api_key");
|
||||
string apikey = headerValues.FirstOrDefault();
|
||||
|
||||
if (apikeys.Contains(apikey)) { return true; }
|
||||
if (apikeys.Contains(apikey) && checkfunction(apikey,function)==true) { return true; }
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
if (request.Headers.Authorization.Scheme == "Bearer" && apikeys.Contains(request.Headers.Authorization.Parameter.ToString()))
|
||||
//== GetValue("Bearer"))
|
||||
if (request.Headers.Authorization.Scheme == "Bearer" && apikeys.Contains(request.Headers.Authorization.Parameter.ToString()) && checkfunction(request.Headers.Authorization.Parameter.ToString(),function)==true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { return false; }
|
||||
catch {
|
||||
APILogging.Log(request, "Unberechtigter Zugriff", LogLevelType.Error);
|
||||
return false; }
|
||||
}
|
||||
APILogging.Log(request, "Unberechtigter Zugriff", LogLevelType.Error);
|
||||
return false;
|
||||
}
|
||||
//private readonly RequestDelegate _next;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
36
API_NetFramework/bin/NLog.config
Normal file
36
API_NetFramework/bin/NLog.config
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<target name="console" xsi:type="Console" />
|
||||
<target name="file" xsi:type="File" fileName="${basedir}/log.txt" />
|
||||
<target name="email" xsi:type="Mail"
|
||||
smtpServer="smtp.DomainName.com"
|
||||
smtpAuthentication="Basic"
|
||||
smtpUsername="Username@DomainName.com"
|
||||
smtpPassword =""
|
||||
enableSsl="true"
|
||||
subject="NLog message from system X on ${machinename}"
|
||||
to="Username@DomainName.com"
|
||||
from="Username@DomainName.com" />
|
||||
<target type="Database" name="database" connectionstring="Server=SHU01\SHU00;Database=edoka_journale;User ID=sa;Password=*shu29">
|
||||
<commandText>
|
||||
sp_insert_nlog_api @Origin,@Message,@LogLevel, @UserID, @Div
|
||||
</commandText>
|
||||
<parameter name="@Origin" layout="${gdc:Herkunft}"/>
|
||||
<parameter name="@LogLevel" layout="${level}"/>
|
||||
<parameter name="@message" layout="${message}"/>
|
||||
<parameter name="@UserID" layout="${environment-user}"/>
|
||||
<parameter name="@Div" layout="${gdc:Zusatz}"/>
|
||||
</target>
|
||||
|
||||
</targets>
|
||||
<rules>
|
||||
<!--<logger name="*" levels="Info,Error,Debug,Warn,Trace,Fail" writeTo="console" />-->
|
||||
<logger name="*" levels="Info,Error" writeTo="console" />
|
||||
<logger name="*" levels="Info,Debug,Error" writeTo="file" />
|
||||
<logger name="*" levels="Info,Debug,Error" writeTo="Database" />
|
||||
<!-- <logger name="*" levels="Error" writeTo="email" /> -->
|
||||
</rules>
|
||||
</nlog>
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="UnterschriftPath" value="x:\docdemo\unterschriften\" />
|
||||
<add key="Bearer" value ="abc"/>
|
||||
<add key="APIKeys" value="OnDocEHplewEWbuoNkOGCO1kvoxcHAzsXiJ9qbotaJosOf2zBV2AMlUkOeCsDjxWJrRPpQDRyP2WM83R8bNx7dI8u3A7Zqh1qGQQ7od0lmLNa6HdQv4epmaCytqJDTKu, OnDocFThMC91BXTDhKADoqmDV6yWiWpuSR8uEbhE92feD82jU3uWMeA5nDiAiBorQ5DYx9JFrnMT48wWmIiIQsRRMjjjGDwdGHNiyjufoYUG7dHEWVJ9THlfhZRyHkTy, OnDocqLLhcSJq30Kx2tl28CtBsMxhBMYYdV0vi4hrNOhIyzF3QrEOkiCNF2Fkt4lbVPYIjW6VeBButNniMVlIBozrFpE8NnD44N7cBVVmVKBAvE3xz5wg6oJH8RdRt0q, OnDocExHp86biVL9wTU8WFKWGJzKtOgIxx8NhS7Y4LwuYFsN1gIu3pzXKTf241Poimp9dEDmwflOzZ8svv5j7RJj4Y4vp4JkLic5tK9OsRELhZOxIZFkmHd6tlI8YDiI"/>
|
||||
<add key="APIKeys" value="U3AF12C/o+r8c1fhnk+NkEOduuH9uNH3aZ1AVb0dHN1fxMGLr1s0eKcvoeJ7bPY02ytHD4SjcFb78NiQQyvWtDD+S7noWCyNmaCQkXHMx4LAomlnvnwKPqVs1TQ0qFB+,5sPQAPCxiSj+JWf+sWKTYgdTRSXeZJX/Ft2wE5B/SaSPoxPNMvkTgNjbmiK18SNmJ66OPzOM1fEw70R+VZeRWU+5fowTIXAGYLDneikxmK4HnIJku8732xxJ/9EomCZ6"/>
|
||||
<add key="AuthCheck" value="Yes"/>
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
@@ -114,4 +114,9 @@
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
</handlers>
|
||||
</system.webServer></configuration>
|
||||
</system.webServer></configuration>
|
||||
|
||||
<!--APIKeys
|
||||
Adresse: U3AF12C/o+r8c1fhnk+NkEOduuH9uNH3aZ1AVb0dHN1fxMGLr1s0eKcvoeJ7bPY02ytHD4SjcFb78NiQQyvWtDD+S7noWCyNmaCQkXHMx4LAomlnvnwKPqVs1TQ0qFB+
|
||||
Archiv,Dokument,Unterschrift: 5sPQAPCxiSj+JWf+sWKTYgdTRSXeZJX/Ft2wE5B/SaSPoxPNMvkTgNjbmiK18SNmJ66OPzOM1fEw70R+VZeRWU+5fowTIXAGYLDneikxmK4HnIJku8732xxJ/9EomCZ6
|
||||
-->
|
||||
Binary file not shown.
21
API_NetFramework/log.txt
Normal file
21
API_NetFramework/log.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
2024-10-02 07:21:40.8505|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 07:43:49.7848|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 07:51:54.2031|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 07:54:17.6795|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 07:59:39.9236|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:05:54.3988|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:05:54.4578|INFO|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:06:55.8367|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:07:29.6017|INFO|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:25:35.6429|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:29:39.0375|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:33:31.1733|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:34:16.4038|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:35:29.7274|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 08:35:52.9374|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 09:07:02.2416|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 10:28:59.5874|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 10:43:43.5554|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 10:48:45.9055|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 11:01:33.4541|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
2024-10-02 11:07:36.9066|ERROR|EDOKA|Unberechtigter Zugriff
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
1a456661155b09def0d34c58d83ab25f261280b9a77b3648928636ae4a8c2a1d
|
||||
fd071c09c7dba1a10d40b75954ad2f0d5d3e0976027671a6eb97b96a5125f413
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user