Feature Doppelte Authentifizierung + Download Stückweise abgeschlossen

This commit is contained in:
2023-01-06 14:11:08 +01:00
parent 0b1459df9d
commit 8825798754
28 changed files with 628 additions and 142 deletions

4
.gitignore vendored
View File

@@ -577,3 +577,7 @@ obj
/DownloadServer/obj
/BeWoTest/bin
/BeWoTest/obj
/UnitTestProject472/bin
/UnitTestProject472/obj
/UnitTestProject45/bin
/UnitTestProject45/obj

View File

@@ -45,14 +45,19 @@ namespace BeWoLauncher.Logic.Behavior
}
else
{
DownloadController.Start();
if (UninstallMode)
{
DownloadController.Manager.GetUninstallPlan();
ViewBehavior.ShowUninstallInfo();
EndWaiting();
}
else
Task.Run(() =>
{
try
{
DownloadController.Start();
DownloadController.Manager.GetUpdatePlan();
if (DownloadController.Manager.UpdatePlanResponse.HasToDo())

View File

@@ -53,6 +53,18 @@ namespace BeWoLauncher.Logic.Utils.Download
SessionInformation.Session.Version = UpdatePlanResponse.CurrentPackage.Version;
}
public void GetUninstallPlan()
{
UpdatePlanResponse = new UpdatePlanResponse();
if (LauncherPaths.ActualPlanerLocation.Exists())
{
if (ApplyFolder.Exists())
if (!ApplyFolder.IsFolderEmpty())
UpdatePlanResponse.FilesToDeleteInApply = FileController.GetAppliedFiles(ApplyFolder, false);
}
}
public void StartProcess(BackgroundWorker worker)
{
var report = new Action<LauncherProgress, int>((progress, waitms) =>
@@ -124,7 +136,7 @@ namespace BeWoLauncher.Logic.Utils.Download
Feedback((int)LauncherProgress.DownloadUpdate, new DownloadProgressEventArgs(size, file2request));
}
DownloadFolder.Unlock();
DownloadFolder.Unlock(SkipLock);
}
public void Apply()
{
@@ -167,7 +179,7 @@ namespace BeWoLauncher.Logic.Utils.Download
DownloadFolder.ClearFolder();
ApplyFolder.Unlock();
ApplyFolder.Unlock(SkipLock);
}
private void CreateUpdatePlanRequest()
@@ -185,11 +197,11 @@ namespace BeWoLauncher.Logic.Utils.Download
UpdatePlanRequest.ApplyPackage = FileController.GetApplyPackage(ApplyFolder);
}
UpdatePlanRequest.Login = new LoginDC()
UpdatePlanRequest.Session = new SessionDC()
{
Username = SessionInformation.Login.Username,
Password = SessionInformation.Login.Password,
CoreServerAddress = SessionInformation.Connection.CoreServerAddress,
CoreServerAddress = SessionInformation.Connection.CoreServerAddressExact,
Pin = SessionInformation.Login.Pin,
ClientID = SessionInformation.Login.ClientId,
CheckTenant = true,

View File

@@ -39,16 +39,29 @@ namespace BeWoLauncher.View.Frames
{
InitializeComponent();
proBar1.IsIndeterminate = false;
proBar1.Minimum = 0;
proBar1.Maximum = 100;
proBar2.IsIndeterminate = false;
proBar2.Minimum = 0;
proBar2.Maximum = DownloadController.Manager.FilesToProcessTotal;
LauncherMode = mode;
if(mode == LauncherMode.Install || mode == LauncherMode.Update)
{
proBar1.IsIndeterminate = false;
proBar1.Minimum = 0;
proBar1.Maximum = 100;
proBar2.IsIndeterminate = false;
proBar2.Minimum = 0;
proBar2.Maximum = DownloadController.Manager.FilesToProcessTotal;
}
else
{
proBar1.Visibility = Visibility.Collapsed;
proBar2.IsIndeterminate = true;
proBar2.Minimum = 0;
proBar2.Maximum = DownloadController.Manager.FilesToDeleteInApplyCount;
}
keyword_mode = (int)mode;
Loaded += (s, e) => Start();

View File

@@ -39,16 +39,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CA77E4CE-3
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeWoTest", "BeWoTest\BeWoTest.csproj", "{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{825B9513-40EF-48C1-A354-9D4503A3FA74}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject45", "UnitTestProject45\UnitTestProject45.csproj", "{D842A26A-C425-4E28-9A5E-A9993F949862}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject472", "UnitTestProject472\UnitTestProject472.csproj", "{9FDC0675-73D8-4C3B-AA14-425280AD8F58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|.NET = Release|.NET
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|.NET.ActiveCfg = Debug|Any CPU
@@ -56,153 +60,225 @@ Global
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|x86.ActiveCfg = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|x86.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|.NET.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.Build.0 = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|x86.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|x86.Build.0 = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|.NET.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|x86.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|x86.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|.NET.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.Build.0 = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|x86.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|x86.Build.0 = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|.NET.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|x86.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|x86.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|.NET.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.Build.0 = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|x86.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|x86.Build.0 = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|.NET.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|x86.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|x86.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|.NET.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.Build.0 = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|x86.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|x86.Build.0 = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|x86.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|.NET.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.Build.0 = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|x86.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|x86.Build.0 = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|.NET.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|x86.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|x86.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|.NET.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.Build.0 = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|x86.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|x86.Build.0 = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|.NET.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|x86.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|x86.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|.NET.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.Build.0 = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|x86.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|x86.Build.0 = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|.NET.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|x86.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|x86.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|.NET.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.Build.0 = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|x86.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|x86.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|x86.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|x86.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|x86.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|x86.Build.0 = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|.NET.ActiveCfg = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|.NET.Build.0 = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|x86.ActiveCfg = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Debug|x86.Build.0 = Debug|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|.NET.ActiveCfg = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|.NET.Build.0 = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|Any CPU.Build.0 = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|x86.ActiveCfg = Release|Any CPU
{E3BA193A-A64F-4CE6-91BE-F54E551797BE}.Release|x86.Build.0 = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|.NET.ActiveCfg = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|.NET.Build.0 = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|x86.ActiveCfg = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Debug|x86.Build.0 = Debug|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|.NET.ActiveCfg = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|.NET.Build.0 = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|Any CPU.Build.0 = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|x86.ActiveCfg = Release|Any CPU
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}.Release|x86.Build.0 = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|.NET.ActiveCfg = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|.NET.Build.0 = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|x86.ActiveCfg = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Debug|x86.Build.0 = Debug|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|.NET.ActiveCfg = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|.NET.Build.0 = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Any CPU.Build.0 = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|x86.ActiveCfg = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|x86.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|.NET.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|.NET.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Any CPU.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|x86.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|x86.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|.NET.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|.NET.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Any CPU.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Any CPU.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|.NET.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|.NET.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|.NET.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|.NET.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Any CPU.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|x86.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|x86.Build.0 = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|.NET.Build.0 = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|x86.ActiveCfg = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Debug|x86.Build.0 = Debug|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|.NET.ActiveCfg = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|.NET.Build.0 = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|Any CPU.Build.0 = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|x86.ActiveCfg = Release|Any CPU
{D842A26A-C425-4E28-9A5E-A9993F949862}.Release|x86.Build.0 = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|.NET.ActiveCfg = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|.NET.Build.0 = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|x86.ActiveCfg = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Debug|x86.Build.0 = Debug|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|.NET.ActiveCfg = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|.NET.Build.0 = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|Any CPU.Build.0 = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|x86.ActiveCfg = Release|Any CPU
{9FDC0675-73D8-4C3B-AA14-425280AD8F58}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -15,7 +15,7 @@
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -94,6 +94,10 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Service\Service.csproj">
<Project>{094331c3-ecee-4c89-bbfd-4c9ded89f0ef}</Project>
<Name>Service</Name>
</ProjectReference>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj">
<Project>{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}</Project>
<Name>SharedLauncher</Name>

View File

@@ -37,7 +37,7 @@ namespace BeWo.Service.Security
string lServiceInterface = lTemp[lTemp.Count - 2];
// TODO Hier kann man jetzt etwas bauen wer sich für welchen service autorisieren muss...
var skip = new string[] { "Download", "Download2", "DownloadInfo" };
var skip = new string[] { "Download", "Download2", "DownloadInfo", "GetUpdatePlan", "GetUpdateFile" };
if (lMethodName == "IsUserValid" || lMethodName == "IsUserValidTwoFactor" || lMethodName == "ResetTenant" || lMethodName == "ResetAllTenant" || lMethodName == "GetEmailForUserName")
{
return null;

View File

@@ -483,8 +483,9 @@
<Compile Include="ServiceProxy\ServiceGenerated.cs" />
<Compile Include="ServiceUtils\Paths\ServerFilePaths.cs" />
<Compile Include="ServiceUtils\Update\UpdateConfigReader.cs" />
<Compile Include="ServiceUtils\Update\UpdateFileResponseBuilder.cs" />
<Compile Include="ServiceUtils\Update\UpdatePlanResponseBuilder.cs" />
<Compile Include="ServiceUtils\Update\UpdateFileResponseHelper.cs" />
<Compile Include="ServiceUtils\Update\UpdatePlanResponseHelper.cs" />
<Compile Include="ServiceUtils\Update\UpdateRequestValidator.cs" />
<Compile Include="UnitOfWork\HibernateSessionEndpointBehavior.cs" />
<Compile Include="UnitOfWork\HibernateSessionBehaviorExtension.cs" />
<Compile Include="UnitOfWork\HibernateSessionContextInitializer.cs" />

View File

@@ -39,13 +39,11 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
if (!isUpdatePlanRequestValid(request))
throw new InvalidUpdatePlanRequestException();
if (!VerifyLogin(request))
throw new InvalidUpdatePlanRequestException("Login konnte nicht aufm Download Server verifiziert werden.");
var response = UpdatePlanResponseBuilder.GetUpdatePlanResponse(request, Tenant);
var exception = UpdateRequestValidator.IsUpdatePlanRequestValid(request, Tenant);
if (exception is object)
throw new InvalidUpdatePlanRequestException(exception);
var response = UpdatePlanResponseHelper.GetUpdatePlanResponse(request, Tenant);
return response;
}
@@ -63,10 +61,11 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
if (!isUpdateFileRequestValid(request))
throw new InvalidUpdateFileRequestException();
var exception = UpdateRequestValidator.IsUpdateFileRequestValid(request, Tenant);
if (exception is object)
throw new InvalidUpdateFileRequestException(exception);
var response = UpdateFileResponseBuilder.GetUpdateFileResponse(request, Tenant);
var response = UpdateFileResponseHelper.GetUpdateFileResponse(request, Tenant);
return response;
}
@@ -79,35 +78,5 @@ namespace BeWo.Service.ServiceImplementations
throw new UpdateException("Update - GetUpdateFile - Exception", ex);
}
}
private bool VerifyLogin(UpdatePlanRequest request)
{
SessionInformation.Login.Username = request.Login.Username;
SessionInformation.Login.Password = request.Login.Password;
SessionInformation.Login.Tenant = Tenant;
ServiceFacade.UpdateServerAddresses(request.Login.CoreServerAddress);
var result = ServiceFacade.DoLauncherServiceSync(x => x.IsUserValid(request.Login.TempUsername, request.Login.Password, request.Login.Pin, request.Login.ClientID, true));
if (result == UserValidationResult.UserValid)
return true;
return false;
}
private bool isUpdatePlanRequestValid(UpdatePlanRequest request)
{
return true;
}
private bool isUpdateFileRequestValid(UpdateFileRequest request)
{
// Check for Login
// Check for Correct Version
// Check for File Permissions
return true;
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Exceptions;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
@@ -30,9 +32,9 @@ namespace BeWo.Service.ServiceUtils.Paths
private static string _DownloadVersionFilePath;
private static string _DownloadFolderPath;
private static string _LogFolderPath;
public static string DownloadVersionFilePath => GetAppSettings(_DownloadVersionFilePath, "DownloadVersionFilePath");
public static string DownloadFolderPath => GetAppSettings(_DownloadFolderPath, "DownloadFolderPath");
public static string DownloadFolderPath => GetAppSettings(_DownloadFolderPath, "DownloadFolderPath") ?? @"D:\Rene\ServerBeWoDataExample2\";
public static string LogFolderPath => GetAppSettings(_LogFolderPath, "LogFolderPath");
static ServerFilePaths()
@@ -59,5 +61,34 @@ namespace BeWo.Service.ServiceUtils.Paths
return name;
}
public static string GetSourceFolderPath(UpdateFileSource source, string version, string tenant)
{
switch (source)
{
case BS.SharedLauncher.Enums.UpdateFileSource.Invalid:
throw new UpdateException("Invalid UpdateFileSource");
case BS.SharedLauncher.Enums.UpdateFileSource.VersionDefault:
return GetVersionDefaultFolderPath(version);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionTenant:
return GetVersionTenantFolderPath(version, tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionUser:
break;
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideTenant:
return GetOverrideTenantFolderPath(tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideUser:
break;
default:
break;
}
// User bekommt eigene Daten Feature
throw new NotImplementedException("#479839129");
}
}
}

View File

@@ -1,4 +1,5 @@
using BS.SharedLauncher.Enums;
using BeWo.Service.ServiceUtils.Paths;
using BS.SharedLauncher.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,12 +9,34 @@ using System.Xml;
namespace BeWo.Service.ServiceUtils.Update
{
public class UpdateConfigReader
public static class UpdateConfigReader
{
public static Tuple<string, string> GetDefaultTenantVersion(string tenant)
{
var reader = new UpdateConfigReaderClient(ServerFilePaths.GetVersionConfigFilePath(), tenant);
return new Tuple<string, string>(reader.GetDefaultVersion(), reader.GetSpecificVersion());
}
public static string GetValidVersion(string tenant)
{
var tuple = GetDefaultTenantVersion(tenant);
return GetValidVersion(tuple.Item1, tuple.Item2);
}
public static string GetValidVersion(string default_version, string tenant_version)
{
return tenant_version ?? default_version;
}
}
internal class UpdateConfigReaderClient
{
private XmlDocument Document{ get; set; }
private string Tenant { get; set; }
public UpdateConfigReader(string configFilePath, string tenant)
internal UpdateConfigReaderClient(string configFilePath, string tenant)
{
Document = new XmlDocument();
Document.Load(configFilePath);

View File

@@ -1,5 +1,6 @@
using BeWo.Service.ServiceUtils.Paths;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Exceptions;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Logic;
@@ -13,7 +14,7 @@ using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public static class UpdateFileResponseBuilder
public static class UpdateFileResponseHelper
{
private static string _Version;
private static string _Tenant;
@@ -35,39 +36,10 @@ namespace BeWo.Service.ServiceUtils.Update
private static void calculate()
{
var path = Path.Combine(getSourceFolderPath(), _Request.UpdateFile.RelativePath);
_Response.FileData = File.ReadAllBytes(path);
_Response.FileData = File.ReadAllBytes(_Request.UpdateFile.AbsolutePath);
}
private static string getSourceFolderPath()
{
switch (_Request.UpdateFile.Source)
{
case BS.SharedLauncher.Enums.UpdateFileSource.Invalid:
throw new UpdateException("Invalid UpdateFileSource");
case BS.SharedLauncher.Enums.UpdateFileSource.VersionDefault:
return ServerFilePaths.GetVersionDefaultFolderPath(_Version);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionTenant:
return ServerFilePaths.GetVersionTenantFolderPath(_Version, _Tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionUser:
break;
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideTenant:
return ServerFilePaths.GetOverrideTenantFolderPath(_Tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideUser:
break;
default:
break;
}
// User bekommt eigene Daten Feature
throw new NotImplementedException("#479839129");
}
//public static UpdateResponse GetUpdatePlanResponse(UpdateRequest request, string tenant)
//{

View File

@@ -15,17 +15,18 @@ using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public static class UpdatePlanResponseBuilder
public static class UpdatePlanResponseHelper
{
private static UpdatePlanRequest _Request;
private static UpdatePlanResponse _Response;
private static string _Version;
private static string _Tenant;
public static UpdatePlanResponse GetUpdatePlanResponse(UpdatePlanRequest request, string tenant)
{
var reader = new UpdateConfigReader(ServerFilePaths.GetVersionConfigFilePath(), tenant);
var (default_version, tenant_version) = UpdateConfigReader.GetDefaultTenantVersion(tenant);
_Version = UpdateConfigReader.GetValidVersion(default_version, tenant_version);
_Tenant = tenant;
_Request = request;
@@ -33,13 +34,11 @@ namespace BeWo.Service.ServiceUtils.Update
{
CurrentPackage = new UpdatePlanDC
{
DefaultVersion = reader.GetDefaultVersion(),
TenantVersion = reader.GetSpecificVersion()
DefaultVersion = default_version,
TenantVersion = tenant_version
}
};
_Version = _Response.CurrentPackage.Version;
// Lädt komplettes Paket ohne Hash
CalcFullPackage();

View File

@@ -0,0 +1,124 @@
using BeWo.Data;
using BeWo.Service.ServiceProxy;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Information;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using BeWo.Service.ServiceUtils.Paths;
namespace BeWo.Service.ServiceUtils.Update
{
public static class UpdateRequestValidator
{
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns>Exception string, otherwise null</returns>
public static string IsUpdatePlanRequestValid(UpdatePlanRequest request, string tenant)
{
if (!VerifySession(request.Session, tenant))
return "Session konnte nicht verifiziert werden.";
return null;
}
public static string IsUpdateFileRequestValid(UpdateFileRequest request, string tenant)
{
// Check for Login ?
// Check for File Permissions ?
if (!VerifyVersion(request, tenant))
return $"Version konnte nicht bestätigt werden. Angefragte Version:{request.Version}";
if (!VerifySource(request))
return $"Datei Herkunft konnte nicht bestätigt werden. File:{request.UpdateFile.RelativePath}, Source:{request.UpdateFile.Source}";
if (!ValidPath(request.UpdateFile, request.Version, tenant))
return $"Datei Pfad konnte nicht bestätigt werden. Path:{request.UpdateFile.RelativePath}";
return null;
}
private static bool VerifySession(SessionDC session, string tenant)
{
SessionInformation.Login.Username = session.Username;
SessionInformation.Login.Password = session.Password;
SessionInformation.Login.Tenant = tenant;
ServiceFacade.UpdateServerAddresses(session.CoreServerAddress);
var result = ServiceFacade.DoLauncherServiceSync(x => x.IsUserValid(session.TempUsername, session.Password, session.Pin, session.ClientID, true));
if (result == UserValidationResult.UserValid)
return true;
return false;
}
private static bool VerifyVersion(UpdateFileRequest request, string tenant)
{
var version_config = UpdateConfigReader.GetValidVersion(tenant);
return request.Version == version_config;
}
private static bool VerifySource(UpdateFileRequest request)
{
switch (request.UpdateFile.Source)
{
case UpdateFileSource.Invalid:
return false;
case UpdateFileSource.VersionDefault:
break;
case UpdateFileSource.VersionTenant:
break;
case UpdateFileSource.VersionUser:
return false;
case UpdateFileSource.OverrideTenant:
break;
case UpdateFileSource.OverrideUser:
return false;
default:
return false;
}
return true;
}
public static bool ValidPath(UpdateFileDC fileDC, string version, string tenant)
{
var source_folder = ServerFilePaths.GetSourceFolderPath(fileDC.Source, version, tenant);
var requested_path = Path.Combine(source_folder, fileDC.RelativePath);
Regex regex = new Regex(@"([a-zA-Z0-9\s_\\.\-:])+(.dat)$");
Match match = regex.Match(requested_path);
if (match.Success)
{
if (File.Exists(requested_path) && Path.GetFullPath(requested_path).StartsWith(source_folder, StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
// "File not found";
return false;
}
}
else
{
// "File name not valid"
return false;
}
}
}
}

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class LoginDC
public class SessionDC
{
[DataMember]
public string Username { get; set; }

View File

@@ -43,6 +43,6 @@ namespace BS.SharedLauncher.DataContract
public UpdatePlanDC ApplyPackage { get; set; }
[DataMember]
public LoginDC Login { get; set; }
public SessionDC Session { get; set; }
}
}

View File

@@ -19,6 +19,5 @@ namespace BS.SharedLauncher.Exceptions
public UpdateException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
}

View File

@@ -72,11 +72,11 @@ namespace BS.SharedLauncher.Extensions
using (File.Create(file));
}
public static void Unlock(this string path)
public static void Unlock(this string path, bool skiplock)
{
var file = Path.Combine(path, BeWoPathFileConfig.LockFileName);
if (!File.Exists(file))
if (!skiplock && !File.Exists(file))
throw new ArgumentException($"Unlock nicht möglich, Lock existiert nicht", path);
File.Delete(file);

View File

@@ -29,10 +29,14 @@ namespace BS.SharedLauncher.Logic
if (package == null)
package = new UpdatePlanDC();
package.Files = GetPlanerFiles(applyFolder, true, null);
package.Files = GetAppliedFiles(applyFolder, true);
return package;
}
public static List<UpdateFileDC> GetAppliedFiles(string applyFolder, bool hash)
{
return GetPlanerFiles(applyFolder, hash, null);
}
public static UpdatePlanDC LoadPackageInfo(string filepath)
{
filepath = filepath.WithInfoExtension();

View File

@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestProject45")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestProject45")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("d842a26a-c425-4e28-9a5e-a9993f949862")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,10 +1,11 @@
using System;
using BS.SharedLauncher.Information;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests
namespace UnitTestProject45
{
[TestClass]
public class SharedLauncherTests
public class UnitTest1
{
[TestMethod]
public void TestLoginLength()

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D842A26A-C425-4E28-9A5E-A9993F949862}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestProject45</RootNamespace>
<AssemblyName>UnitTestProject45</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj">
<Project>{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}</Project>
<Name>SharedLauncher</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net45" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestProject472")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestProject472")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("9fdc0675-73d8-4c3b-aa14-425280ad8f58")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,62 @@
using System;
using BeWo.Data;
using BeWo.Service.ServiceImplementations;
using BeWo.Service.ServiceUtils.Update;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject472
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void DotDotShlashAttack1()
{
var tenant = "demo";
var file = new UpdateFileDC()
{
RelativePath = "../../../secure.txt",
Name = "secure.txt",
Source = BS.SharedLauncher.Enums.UpdateFileSource.VersionDefault,
AbsolutePath = "D:/Rene/ServerBeWoDataExample2/secure.txt"
};
var request = new UpdateFileRequest()
{
UpdateFile = file,
Version = "1"
};
file.LoadHash();
var res = UpdateFileResponseHelper.GetUpdateFileResponse(request, tenant);
Assert.IsNotNull(res);
}
[TestMethod]
public void DotDotShlashDefense1()
{
var tenant = "demo";
var file = new UpdateFileDC()
{
RelativePath = "../../../secure.txt",
Name = "secure.txt",
Source = BS.SharedLauncher.Enums.UpdateFileSource.VersionDefault,
AbsolutePath = "D:/Rene/ServerBeWoDataExample2/secure.txt"
};
var request = new UpdateFileRequest()
{
UpdateFile = file,
Version = "1"
};
file.LoadHash();
var validation = UpdateRequestValidator.ValidPath(request.UpdateFile, request.Version, tenant);
Assert.IsFalse(validation);
}
}
}

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9FDC0675-73D8-4C3B-AA14-425280AD8F58}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestProject472</RootNamespace>
<AssemblyName>UnitTestProject472</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Data.csproj">
<Project>{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}</Project>
<Name>Data</Name>
</ProjectReference>
<ProjectReference Include="..\Service\Service.csproj">
<Project>{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}</Project>
<Name>Service</Name>
</ProjectReference>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj">
<Project>{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}</Project>
<Name>SharedLauncher</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
</packages>

View File

@@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj" />
</ItemGroup>
</Project>