Merge branch 'master' into feature_rene_17_xrechnung
# Conflicts: # BeWo/ServiceProxy/Generated.cs # BeWo/Services/BeWoWindowService.cs # BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs # BeWo/View/Windows/BeWoWindowBuilder.cs # Data/Data.csproj # Host/ServiceRecordPage.aspx.cs # Service/Core/ServiceHelper.cs # Service/Security/SecurityContextInitializer.cs # Service/ServiceBehavior/AdminMultitenancyContextInitializer.cs
This commit is contained in:
@@ -11,7 +11,6 @@ using System.Web;
|
||||
using System.Xml;
|
||||
using System.ServiceModel.Dispatcher;
|
||||
using BeWo.Service.Core;
|
||||
using BS.Shared.Extensions;
|
||||
using BeWo.Service.ServiceUtils;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
using DevExpress.CodeParser;
|
||||
|
||||
@@ -67,31 +67,24 @@ namespace BeWo.Service.ServiceBehavior
|
||||
|
||||
public void ValidateApiKey(ref Message request, IClientChannel channel)
|
||||
{
|
||||
try
|
||||
{
|
||||
ValidateServiceApiKey(ref request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ValidateMethodApiKey(ref request, channel);
|
||||
}
|
||||
ValidateMethodApiKey(ref request, channel);
|
||||
}
|
||||
|
||||
public void ValidateServiceApiKey(ref Message request)
|
||||
{
|
||||
// Hole erlaubten API Key aus den appSettings
|
||||
string allowedApikey = ConfigurationManager.AppSettings["AdminServiceAPIKey"];
|
||||
//public void ValidateServiceApiKey(ref Message request)
|
||||
//{
|
||||
// //// Hole erlaubten API Key aus den appSettings
|
||||
// //string allowedApikey = MergedConfig.GetSecretSetting(WebSecretConfigSetting.AdminServiceAPIKey);
|
||||
|
||||
// Extrahiert den API Key von Remote
|
||||
var prop = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];
|
||||
var remoteApikey = prop?.Headers["admin-service-api-key"];
|
||||
// //// Extrahiert den API Key von Remote
|
||||
// //var prop = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];
|
||||
// //var remoteApikey = prop?.Headers["admin-service-api-key"];
|
||||
|
||||
// Vergleicht die API Keys
|
||||
if (remoteApikey == null || !string.Equals(remoteApikey, allowedApikey, StringComparison.Ordinal))
|
||||
{
|
||||
throw new UnauthorizedAccessException($"Zugriff verweigert. API Key ({remoteApikey ?? "Unbekannt"}) ist nicht erlaubt.");
|
||||
}
|
||||
}
|
||||
// //// Vergleicht die API Keys
|
||||
// //if (remoteApikey == null || !string.Equals(remoteApikey, allowedApikey, StringComparison.Ordinal))
|
||||
// //{
|
||||
// // throw new UnauthorizedAccessException($"Zugriff verweigert. API Key ({remoteApikey ?? "Unbekannt"}) ist nicht erlaubt.");
|
||||
// //}
|
||||
//}
|
||||
|
||||
public void ValidateMethodApiKey(ref Message request, IClientChannel channel)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Service.Core;
|
||||
using BeWo.Service.ServiceUtils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
Reference in New Issue
Block a user