Przeglądaj źródła

Erster Authentifizierung erfolgreich.

Arne Diekmann 8 lat temu
rodzic
commit
6b911e4266
43 zmienionych plików z 1120 dodań i 147 usunięć
  1. 30 0
      GreenTree.Nachtragsmanagement.Core/Authentication/IUserHelper.cs
  2. 70 0
      GreenTree.Nachtragsmanagement.Core/Authentication/UserHelper.cs
  3. 33 0
      GreenTree.Nachtragsmanagement.Core/Configuration/AppendixConfigurationSection.cs
  4. 60 0
      GreenTree.Nachtragsmanagement.Core/Configuration/LdapServerElement.cs
  5. 16 7
      GreenTree.Nachtragsmanagement.Core/GreenTree.Nachtragsmanagement.Core.csproj
  6. 131 0
      GreenTree.Nachtragsmanagement.Core/StaticHelper.cs
  7. 11 0
      GreenTree.Nachtragsmanagement.Core/app.config
  8. 4 3
      GreenTree.Nachtragsmanagement.Core/packages.config
  9. 8 0
      GreenTree.Nachtragsmanagement.Data/App.config
  10. 9 6
      GreenTree.Nachtragsmanagement.Plugin.Test/Controllers/TestController.cs
  11. 1 1
      GreenTree.Nachtragsmanagement.Plugin.Test/Description.txt
  12. 129 52
      GreenTree.Nachtragsmanagement.Plugin.Test/GreenTree.Nachtragsmanagement.Plugin.Test.csproj
  13. 11 12
      GreenTree.Nachtragsmanagement.Plugin.Test/Properties/AssemblyInfo.cs
  14. 1 5
      GreenTree.Nachtragsmanagement.Plugin.Test/TestPlugin.cs
  15. 30 0
      GreenTree.Nachtragsmanagement.Plugin.Test/Web.Debug.config
  16. 31 0
      GreenTree.Nachtragsmanagement.Plugin.Test/Web.Release.config
  17. 63 0
      GreenTree.Nachtragsmanagement.Plugin.Test/Web.config
  18. 0 21
      GreenTree.Nachtragsmanagement.Plugin.Test/app.config
  19. 5 1
      GreenTree.Nachtragsmanagement.Plugin.Test/packages.config
  20. 2 0
      GreenTree.Nachtragsmanagement.Services/GreenTree.Nachtragsmanagement.Services.csproj
  21. 52 0
      GreenTree.Nachtragsmanagement.Services/User/AuthenticationService.cs
  22. 21 0
      GreenTree.Nachtragsmanagement.Services/User/IAuthenticationService.cs
  23. 4 0
      GreenTree.Nachtragsmanagement.Services/app.config
  24. 17 2
      GreenTree.Nachtragsmanagement.Web.Framework/ApplicationContext.cs
  25. 63 0
      GreenTree.Nachtragsmanagement.Web.Framework/Authorization/RoleAuthorizeAttribute.cs
  26. 9 7
      GreenTree.Nachtragsmanagement.Web.Framework/GreenTree.Nachtragsmanagement.Web.Framework.csproj
  27. 11 0
      GreenTree.Nachtragsmanagement.Web.Framework/app.config
  28. 3 3
      GreenTree.Nachtragsmanagement.Web.Framework/packages.config
  29. 6 3
      GreenTree.Nachtragsmanagement.Web/App_Start/FilterConfig.cs
  30. 6 3
      GreenTree.Nachtragsmanagement.Web/App_Start/RouteConfig.cs
  31. 6 3
      GreenTree.Nachtragsmanagement.Web/App_Start/WebApiConfig.cs
  32. 33 0
      GreenTree.Nachtragsmanagement.Web/Controllers/AuthController.cs
  33. 4 0
      GreenTree.Nachtragsmanagement.Web/Controllers/HomeController.cs
  34. 55 0
      GreenTree.Nachtragsmanagement.Web/Controllers/LoginController.cs
  35. 5 0
      GreenTree.Nachtragsmanagement.Web/GreenTree.Nachtragsmanagement.Web.csproj
  36. 13 0
      GreenTree.Nachtragsmanagement.Web/Models/Login/LoginModel.cs
  37. BIN
      GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/GreenTree.Nachtragsmanagement.Plugin.Test.dll
  38. 57 11
      GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/GreenTree.Nachtragsmanagement.Plugin.Test.dll.config
  39. 12 0
      GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/Views/Home/Index.cshtml
  40. 72 0
      GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/Web.config
  41. 17 0
      GreenTree.Nachtragsmanagement.Web/Views/Login/Index.cshtml
  42. 3 1
      GreenTree.Nachtragsmanagement.Web/Web.config
  43. 6 6
      GreenTree.Nachtragsmanagement.sln

+ 30 - 0
GreenTree.Nachtragsmanagement.Core/Authentication/IUserHelper.cs

@@ -0,0 +1,30 @@
+using GreenTree.Nachtragsmanagement.Core.Domain.User;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Core.Authentication
+{
+    public interface IUserHelper
+    {
+        /// <summary>
+        /// Evaluates the current user from request cookies
+        /// </summary>
+        User FromCookies();
+
+        /// <summary>
+        /// Evaluates the current user from request cookies
+        /// </summary>
+        /// <param name="expirationHoursIncrease">The hours the authCookie will be increased if it exists.</param>
+        User FromCookies(int expirationHoursIncrease);
+
+        /// <summary>
+        /// Writes the current user to response cookies
+        /// </summary>
+        /// <param name="user">The current authenticated user.</param>
+        /// <param name="expirationDate">The cookie expiration date.</param>
+        void ToCookies(User user, DateTime expirationDate);
+    }
+}

+ 70 - 0
GreenTree.Nachtragsmanagement.Core/Authentication/UserHelper.cs

@@ -0,0 +1,70 @@
+using GreenTree.Nachtragsmanagement.Core.Domain.User;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web;
+
+namespace GreenTree.Nachtragsmanagement.Core.Authentication
+{
+    public class UserHelper : IUserHelper
+    {
+        /// <summary>
+        /// Evaluates the current user from request cookies
+        /// </summary>
+        public User FromCookies()
+        {
+            return FromCookies(2);
+        }
+
+        /// <summary>
+        /// Evaluates the current user from request cookies
+        /// </summary>
+        /// <param name="expirationHoursIncrease">The hours the authCookie will be increased if it exists.</param>
+        public User FromCookies(int expirationHoursIncrease)
+        {
+            if (HttpContext.Current == null || HttpContext.Current.Session == null) return null;
+
+            var authCookie = HttpContext.Current.Request.Cookies["auth"];
+
+            if (authCookie == null)
+                return null;
+
+            var user = JsonConvert.DeserializeObject<User>(StaticHelper.DecompressString(authCookie.Value));
+
+            if (user != null)
+            {
+                authCookie.Expires = DateTime.Now.AddHours(expirationHoursIncrease);
+
+                HttpContext.Current.Response.Cookies.Set(authCookie);
+            }
+
+            return user;
+        }
+
+        /// <summary>
+        /// Writes the current user to response cookies
+        /// </summary>
+        /// <param name="user">The current authenticated user.</param>
+        /// <param name="expirationDate">The cookie expiration date.</param>
+        public void ToCookies(User user, DateTime expirationDate)
+        {
+            if (HttpContext.Current == null || HttpContext.Current.Session == null) return;
+
+            var authCookie = HttpContext.Current.Request.Cookies["auth"];
+
+            var userJson = JsonConvert.SerializeObject(user);
+
+            authCookie = new HttpCookie("auth", StaticHelper.CompressString(userJson))
+            {
+                Expires = expirationDate
+            };
+
+            HttpContext.Current.Response.Cookies.Set(authCookie);
+        }
+    }
+}

+ 33 - 0
GreenTree.Nachtragsmanagement.Core/Configuration/AppendixConfigurationSection.cs

@@ -9,6 +9,23 @@ namespace GreenTree.Nachtragsmanagement.Core.Configuration
 {
     public class AppendixConfigurationSection : ConfigurationSection
     {
+        /// <summary>
+        /// The anonymous user used by the Microsoft IIS, so the application can differ the anonymous user from
+        /// real domain users
+        /// </summary>
+        [ConfigurationProperty("iisAnonymousUser", DefaultValue = "IUSR", IsRequired = false)]
+        public string IISAnonymousUser
+        {
+            get
+            {
+                return (string)this["iisAnonymousUser"];
+            }
+            set
+            {
+                this["iisAnonymousUser"] = value;
+            }
+        }
+
         /// <summary>
         /// Settings for mailserver handling
         /// </summary>
@@ -24,5 +41,21 @@ namespace GreenTree.Nachtragsmanagement.Core.Configuration
                 this["mailserver"] = value;
             }
         }
+
+        /// <summary>
+        /// Settings for LDAP server handling
+        /// </summary>
+        [ConfigurationProperty("ldapServer")]
+        public LdapServerElement LdapServerElement
+        {
+            get
+            {
+                return (LdapServerElement)this["ldapServer"];
+            }
+            set
+            {
+                this["ldapServer"] = value;
+            }
+        }
     }
 }

+ 60 - 0
GreenTree.Nachtragsmanagement.Core/Configuration/LdapServerElement.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Core.Configuration
+{
+    public class LdapServerElement : ConfigurationElement
+    {
+        /// <summary>
+        /// LDAP server which should be connected to to authenticate the user
+        /// </summary>
+        [ConfigurationProperty("ldapServer", DefaultValue = "", IsRequired = false)]
+        public string SmtpServer
+        {
+            get
+            {
+                return (string)this["ldapServer"];
+            }
+            set
+            {
+                this["ldapServer"] = value;
+            }
+        }
+
+        /// <summary>
+        /// User which is allowed to query the specified LDAP server
+        /// </summary>
+        [ConfigurationProperty("administriveUser", DefaultValue = "", IsRequired = false)]
+        public string AdministriveUser
+        {
+            get
+            {
+                return (string)this["administriveUser"];
+            }
+            set
+            {
+                this["administriveUser"] = value;
+            }
+        }
+
+        /// <summary>
+        /// Password of the administrive user
+        /// </summary>
+        [ConfigurationProperty("password", DefaultValue = "", IsRequired = false)]
+        public string Password
+        {
+            get
+            {
+                return (string)this["password"];
+            }
+            set
+            {
+                this["password"] = value;
+            }
+        }
+    }
+}

+ 16 - 7
GreenTree.Nachtragsmanagement.Core/GreenTree.Nachtragsmanagement.Core.csproj

@@ -40,28 +40,31 @@
       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data.Entity" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.Helpers.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll</HintPath>
     </Reference>
-    <Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.1.0\lib\net45\System.Web.Mvc.dll</HintPath>
+    <Reference Include="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.0\lib\net45\System.Web.Mvc.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Razor.3.1.0\lib\net45\System.Web.Razor.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
     </Reference>
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
@@ -73,11 +76,14 @@
   <ItemGroup>
     <Compile Include="AppDomainTypeFinder.cs" />
     <Compile Include="AppendixVersion.cs" />
+    <Compile Include="Authentication\IUserHelper.cs" />
+    <Compile Include="Authentication\UserHelper.cs" />
     <Compile Include="BaseEntity.cs" />
     <Compile Include="CommonHelper.cs" />
     <Compile Include="ComponentModel\GenericListTypeConverter.cs" />
     <Compile Include="ComponentModel\WriteLockDisposable.cs" />
     <Compile Include="Configuration\AppendixConfigurationSection.cs" />
+    <Compile Include="Configuration\LdapServerElement.cs" />
     <Compile Include="Configuration\MailServerElement.cs" />
     <Compile Include="Data\IRepository.cs" />
     <Compile Include="Domain\Appendix\Appendix.cs" />
@@ -107,11 +113,14 @@
     <Compile Include="Plugins\PluginManager.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Singleton.cs" />
+    <Compile Include="StaticHelper.cs" />
     <Compile Include="WebAppTypeFinder.cs" />
     <Compile Include="WebHelper.cs" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="app.config" />
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 131 - 0
GreenTree.Nachtragsmanagement.Core/StaticHelper.cs

@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Core
+{
+    public static class StaticHelper
+    {
+        #region Encryption
+
+        /// <summary>
+        /// Hashes an input text with MD5
+        /// </summary>
+        /// <param name="text">The input text.</param>
+        public static string GetMD5Hash(string text)
+        {
+            MD5 md5 = MD5.Create();
+
+            var inputBytes = System.Text.Encoding.ASCII.GetBytes(text);
+            var hash = md5.ComputeHash(inputBytes);
+
+            var sb = new StringBuilder();
+
+            for (int i = 0; i < hash.Length; i++)
+                sb.Append(hash[i].ToString("X2"));
+
+            return sb.ToString();
+        }
+
+        #endregion
+
+        #region String-Compression
+
+        /// <summary>
+        /// Compresses a string
+        /// </summary>
+        /// <param name="text">The text to compress.</param>
+        /// <param name="deflate">Determines if the string should be compressed by a DeflateStream.</param>
+        /// <param name="encoding">The base encoding of the text.</param>
+        /// <returns>The compressed text.</returns>
+        public static string CompressString(string text, bool deflate, Encoding encoding)
+        {
+            var buffer = encoding.GetBytes(text);
+            var memoryStream = new MemoryStream();
+
+            if (!deflate)
+                using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, true))
+                {
+                    gZipStream.Write(buffer, 0, buffer.Length);
+                }
+            else
+                using (var deflateStream = new DeflateStream(memoryStream, CompressionMode.Compress, true))
+                {
+                    deflateStream.Write(buffer, 0, buffer.Length);
+                }
+
+            memoryStream.Position = 0;
+
+            var compressedData = new byte[memoryStream.Length];
+            memoryStream.Read(compressedData, 0, compressedData.Length);
+
+            var gZipBuffer = new byte[compressedData.Length + 4];
+
+            Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length);
+            Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, gZipBuffer, 0, 4);
+
+            return Convert.ToBase64String(gZipBuffer);
+        }
+
+        /// <summary>
+        /// Decompresses a string
+        /// </summary>
+        /// <param name="compressedText">The compressed text.</param>
+        /// <param name="deflate">Determines if the string should be decompressed by a DeflateStream.</param>
+        /// <param name="encoding">The base encoding of the compressed text.</param>
+        /// <returns>The decompressed text.</returns>
+        public static string DecompressString(string compressedText, bool deflate, Encoding encoding)
+        {
+            var gZipBuffer = Convert.FromBase64String(compressedText);
+            using (var memoryStream = new MemoryStream())
+            {
+                var dataLength = BitConverter.ToInt32(gZipBuffer, 0);
+                memoryStream.Write(gZipBuffer, 4, gZipBuffer.Length - 4);
+
+                var buffer = new byte[dataLength];
+
+                memoryStream.Position = 0;
+
+                if (!deflate)
+                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Decompress))
+                    {
+                        gZipStream.Read(buffer, 0, buffer.Length);
+                    }
+                else
+                    using (var deflateStream = new DeflateStream(memoryStream, CompressionMode.Decompress))
+                    {
+                        deflateStream.Read(buffer, 0, buffer.Length);
+                    }
+
+                return encoding.GetString(buffer);
+            }
+        }
+
+        /// <summary>
+        /// Compresses a string
+        /// </summary>
+        /// <param name="text">The text to compress.</param>
+        /// <returns>Der komprimierte String.</returns>
+        public static string CompressString(string text)
+        {
+            return CompressString(text, true, Encoding.Default);
+        }
+
+        /// <summary>
+        /// Methode zur Dekomprimierung eines Strings
+        /// </summary>
+        /// <param name="text">The text to be decompressed.</param>
+        /// <returns>The decompressed text.</returns>
+        public static string DecompressString(string text)
+        {
+            return DecompressString(text, true, Encoding.Default);
+        }
+
+        #endregion
+    }
+}

+ 11 - 0
GreenTree.Nachtragsmanagement.Core/app.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 4 - 3
GreenTree.Nachtragsmanagement.Core/packages.config

@@ -2,8 +2,9 @@
 <packages>
   <package id="Autofac" version="4.0.1" targetFramework="net452" />
   <package id="Autofac.Mvc5" version="4.0.2" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Mvc" version="5.1.0" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Razor" version="3.1.0" targetFramework="net452" />
-  <package id="Microsoft.AspNet.WebPages" version="3.1.0" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Mvc" version="5.2.0" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net452" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
+  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
 </packages>

+ 8 - 0
GreenTree.Nachtragsmanagement.Data/App.config

@@ -10,4 +10,12 @@
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
 </configuration>

+ 9 - 6
GreenTree.Nachtragsmanagement.Plugin.Test/Controllers/TestController.cs

@@ -1,27 +1,30 @@
-using GreenTree.Nachtragsmanagement.Services.User;
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Web;
 using System.Web.Mvc;
+using GreenTree.Nachtragsmanagement.Services.User;
+using GreenTree.Nachtragsmanagement.Services.Deviation;
 
 namespace GreenTree.Nachtragsmanagement.Plugin.Test.Controllers
 {
     public class TestController : Controller
     {
         private readonly IUserService _userService;
+        private readonly IDeviationService _deviationService;
 
         public TestController(
-            IUserService userService)
+            IUserService userService,
+            IDeviationService deviationService)
         {
             _userService = userService;
+            _deviationService = deviationService;
         }
 
         // GET: Home
         public ActionResult Index()
         {
-            return View("~/Views/Home/Index.cshtml");
+            return View("~/Plugins/Misc.Test/Views/Home/Index.cshtml");
         }
     }
 }

+ 1 - 1
GreenTree.Nachtragsmanagement.Plugin.Test/Description.txt

@@ -5,4 +5,4 @@ Version: 1.0
 SupportedVersions: 1.0.0
 Author: GreenTree Studios
 DisplayOrder: 1
-FileName: GreenTree.Nachtragsmanagement.Plugin.Test
+FileName: GreenTree.Nachtragsmanagement.Plugin.Test.dll

+ 129 - 52
GreenTree.Nachtragsmanagement.Plugin.Test/GreenTree.Nachtragsmanagement.Plugin.Test.csproj

@@ -1,16 +1,28 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
+  <Import Project="..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.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>{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}</ProjectGuid>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{F60F0134-7C08-4535-8D06-227AA0DC7FC5}</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>GreenTree.Nachtragsmanagement.Plugin.Test</RootNamespace>
     <AssemblyName>GreenTree.Nachtragsmanagement.Plugin.Test</AssemblyName>
     <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
+    <UseIISExpress>true</UseIISExpress>
+    <IISExpressSSLPort />
+    <IISExpressAnonymousAuthentication />
+    <IISExpressWindowsAuthentication />
+    <IISExpressUseClassicPipelineMode />
+    <UseGlobalApplicationHostFile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -22,59 +34,102 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
+    <OutputPath>bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
-      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
-    </Reference>
-    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
-      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
-      <Private>True</Private>
+    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Web.DynamicData" />
+    <Reference Include="System.Web.Entity" />
+    <Reference Include="System.Web.ApplicationServices" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Drawing" />
     <Reference Include="System.Web" />
-    <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="System.Web.Razor">
+      <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
+    <Reference Include="System.Web.Webpages">
+      <HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
+    <Reference Include="System.Web.Webpages.Deployment">
+      <HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Deployment.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Web.Services" />
-    <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
+    <Reference Include="System.Web.Webpages.Razor">
+      <HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Razor.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Web.Helpers">
+      <HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
+    <Reference Include="Microsoft.Web.Infrastructure">
+      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
+    <Reference Include="System.Web.Mvc">
+      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Description.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="logo.jpg">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Web.config">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Controllers\TestController.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="RouteProvider.cs" />
     <Compile Include="TestPlugin.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="packages.config" />
+    <Content Include="Views\Home\Index.cshtml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <None Include="Web.Debug.config">
+      <DependentUpon>Web.config</DependentUpon>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Web.Release.config">
+      <DependentUpon>Web.config</DependentUpon>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Content\" />
+    <Folder Include="Models\" />
+    <Folder Include="Services\" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\GreenTree.Nachtragsmanagement.Core\GreenTree.Nachtragsmanagement.Core.csproj">
@@ -98,21 +153,43 @@
       <Private>False</Private>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup>
-    <Content Include="Description.txt">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="logo.jpg">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Content\" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="app.config" />
-    <None Include="packages.config" />
-    <Content Include="Views\Home\Index.cshtml" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+  </PropertyGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+        <WebProjectProperties>
+          <UseIIS>True</UseIIS>
+          <AutoAssignPort>True</AutoAssignPort>
+          <DevelopmentServerPort>62057</DevelopmentServerPort>
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
+          <IISUrl>http://localhost:62057/</IISUrl>
+          <NTLMAuthentication>False</NTLMAuthentication>
+          <UseCustomServer>False</UseCustomServer>
+          <CustomServerUrl>
+          </CustomServerUrl>
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+        </WebProjectProperties>
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+  <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\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props'))" />
+    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
+  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
 </Project>

+ 11 - 12
GreenTree.Nachtragsmanagement.Plugin.Test/Properties/AssemblyInfo.cs

@@ -2,9 +2,9 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-// Allgemeine Informationen über eine Assembly werden über die folgenden
-// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
-// die einer Assembly zugeordnet sind.
+// Allgemeine Informationen über eine Assembly werden über die folgenden 
+// Attribute gesteuert. Ändern Sie diese Attributwerte, um die
+// Assemblyinformationen zu ändern.
 [assembly: AssemblyTitle("GreenTree.Nachtragsmanagement.Plugin.Test")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
@@ -14,23 +14,22 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
-// für COM-Komponenten unsichtbar.  Wenn Sie auf einen Typ in dieser Assembly von
-// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 
+// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 
+// COM aus zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
 [assembly: ComVisible(false)]
 
-// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
-[assembly: Guid("702a7197-9c1f-4d47-8ef0-db27e97cd66f")]
+// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
+[assembly: Guid("f60f0134-7c08-4535-8d06-227aa0dc7fc5")]
 
 // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
 //
 //      Hauptversion
-//      Nebenversion
+//      Nebenversion 
 //      Buildnummer
 //      Revision
 //
-// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
-// indem Sie "*" wie unten gezeigt eingeben:
-// [assembly: AssemblyVersion("1.0.*")]
+// Sie können alle Werte angeben oder die standardmäßigen Revisions- und Buildnummern 
+// übernehmen, indem Sie "*" wie folgt verwenden:
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 1 - 5
GreenTree.Nachtragsmanagement.Plugin.Test/TestPlugin.cs

@@ -13,11 +13,7 @@ namespace GreenTree.Nachtragsmanagement.Plugin.Test
     {
         public override void Install()
         {
-            RouteTable.Routes.MapRoute(
-                name: "Default", // Route name
-                url: "{controller}/{action}", // URL with parameters
-                defaults: new { controller = "Test", action = "Index" } // Parameter defaults
-            );
+
 
             base.Install();
         }

+ 30 - 0
GreenTree.Nachtragsmanagement.Plugin.Test/Web.Debug.config

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Weitere Informationen zur Verwendung der web.config-Transformation finden Sie unter https://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+  <!--
+    Im folgenden Beispiel wird durch die Transformation "SetAttributes" der Wert von
+    "connectionString" geändert, sodass "ReleaseSQLServer" nur verwendet wird, wenn
+    vom Locator "Match" ein Attribut vom Typ "name" mit dem Wert "MyDB" gefunden wird.
+    
+    <connectionStrings>
+      <add name="MyDB"
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+    </connectionStrings>
+  -->
+  <system.web>
+    <!--
+      Im folgenden Beispiel ersetzt die Transformation "Replace" den gesamten
+      Abschnitt "<customErrors>" der Datei "web.config".
+      Da unter dem Knoten "<system.web>" nur ein Abschnitt vom Typ
+      "customErrors" vorhanden ist, muss das Attribut "xdt:Locator" nicht verwendet werden.
+      
+      <customErrors defaultRedirect="GenericError.htm"
+        mode="RemoteOnly" xdt:Transform="Replace">
+        <error statusCode="500" redirect="InternalError.htm"/>
+      </customErrors>
+    -->
+  </system.web>
+</configuration>

+ 31 - 0
GreenTree.Nachtragsmanagement.Plugin.Test/Web.Release.config

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Weitere Informationen zur Verwendung der web.config-Transformation finden Sie unter https://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+  <!--
+    Im folgenden Beispiel wird durch die Transformation "SetAttributes" der Wert von
+    "connectionString" geändert, sodass "ReleaseSQLServer" nur verwendet wird, wenn
+    vom Locator "Match" ein Attribut vom Typ "name" mit dem Wert "MyDB" gefunden wird.
+    
+    <connectionStrings>
+      <add name="MyDB"
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+    </connectionStrings>
+  -->
+  <system.web>
+    <compilation xdt:Transform="RemoveAttributes(debug)" />
+    <!--
+      Im folgenden Beispiel ersetzt die Transformation "Replace" den gesamten
+      Abschnitt "<customErrors>" der Datei "web.config".
+      Da unter dem Knoten "<system.web>" nur ein Abschnitt vom Typ
+      "customErrors" vorhanden ist, muss das Attribut "xdt:Locator" nicht verwendet werden.
+      
+      <customErrors defaultRedirect="GenericError.htm"
+        mode="RemoteOnly" xdt:Transform="Replace">
+        <error statusCode="500" redirect="InternalError.htm"/>
+      </customErrors>
+    -->
+  </system.web>
+</configuration>

+ 63 - 0
GreenTree.Nachtragsmanagement.Plugin.Test/Web.config

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  For more information on how to configure your ASP.NET application, please visit
+  https://go.microsoft.com/fwlink/?LinkId=301880
+  -->
+<configuration>
+  <configSections>
+    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+    </sectionGroup>
+  </configSections>
+  <system.web.webPages.razor>
+    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+    <pages pageBaseType="System.Web.Mvc.WebViewPage">
+      <namespaces>
+        <add namespace="System.Web.Mvc" />
+        <add namespace="System.Web.Mvc.Ajax" />
+        <add namespace="System.Web.Mvc.Html" />
+        <add namespace="System.Web.Routing" />
+        <add namespace="GreenTree.Nachtragsmanagement.Plugin.Test" />
+      </namespaces>
+    </pages>
+  </system.web.webPages.razor>
+  <appSettings>
+    <add key="webpages:Version" value="3.0.0.0" />
+    <add key="webpages:Enabled" value="false" />
+    <add key="ClientValidationEnabled" value="true" />
+    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
+  </appSettings>
+  <system.web>
+    <compilation debug="true" targetFramework="4.5.2" />
+    <httpRuntime targetFramework="4.5.2" />
+  </system.web>
+  <system.webServer>
+    <handlers>
+      <remove name="BlockViewHandler" />
+      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
+    </handlers>
+  </system.webServer>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <system.codedom>
+    <compilers>
+      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
+    </compilers>
+  </system.codedom>
+</configuration>

+ 0 - 21
GreenTree.Nachtragsmanagement.Plugin.Test/app.config

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-  </configSections>
-  <runtime>
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
-  <entityFramework>
-    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
-    <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
-    </providers>
-  </entityFramework>
-</configuration>

+ 5 - 1
GreenTree.Nachtragsmanagement.Plugin.Test/packages.config

@@ -1,8 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Mvc.de" version="5.2.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Razor.de" version="3.2.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebPages.de" version="3.2.3" targetFramework="net452" />
+  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" />
+  <package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
 </packages>

+ 2 - 0
GreenTree.Nachtragsmanagement.Services/GreenTree.Nachtragsmanagement.Services.csproj

@@ -65,6 +65,8 @@
     <Compile Include="Test\DbRelationFormat.cs" />
     <Compile Include="Test\DbRelationService.cs" />
     <Compile Include="Test\IDbRelationService.cs" />
+    <Compile Include="User\AuthenticationService.cs" />
+    <Compile Include="User\IAuthenticationService.cs" />
     <Compile Include="User\IUserService.cs" />
     <Compile Include="User\UserService.cs" />
   </ItemGroup>

+ 52 - 0
GreenTree.Nachtragsmanagement.Services/User/AuthenticationService.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using GreenTree.Nachtragsmanagement.Services.Configuration;
+using GreenTree.Nachtragsmanagement.Core.Authentication;
+
+namespace GreenTree.Nachtragsmanagement.Services.User
+{
+    public class AuthenticationService : IAuthenticationService
+    {
+        #region Fields
+
+        private readonly IConfigurationService _configurationService;
+        private readonly IUserService _userService;
+        private readonly IUserHelper _userHelper;
+
+        #endregion
+
+        #region Ctor
+
+        /// <summary>
+        /// Initializes a new instance of the UserHelper class
+        /// </summary>
+        public AuthenticationService(
+            IConfigurationService configurationService,
+            IUserService userService,
+            IUserHelper userHelper)
+        {
+            _configurationService = configurationService;
+            _userService = userService;
+            _userHelper = userHelper;
+        }
+
+        public void Authenticate()
+        {
+            throw new NotImplementedException();
+        }
+
+        #endregion
+
+        /// <summary>
+        /// Evaluates the current user of the current session
+        /// </summary>
+        public Core.Domain.User.User Current()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 21 - 0
GreenTree.Nachtragsmanagement.Services/User/IAuthenticationService.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Services.User
+{
+    public interface IAuthenticationService
+    {
+        /// <summary>
+        /// Evaluates the current user of the current session
+        /// </summary>
+        Core.Domain.User.User Current();
+
+        /// <summary>
+        /// Authenticates the current user
+        /// </summary>
+        void Authenticate();
+    }
+}

+ 4 - 0
GreenTree.Nachtragsmanagement.Services/app.config

@@ -6,6 +6,10 @@
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-4.6.1.0" newVersion="4.6.1.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
 </configuration>

+ 17 - 2
GreenTree.Nachtragsmanagement.Web.Framework/ApplicationContext.cs

@@ -24,6 +24,7 @@ using GreenTree.Nachtragsmanagement.Core;
 using GreenTree.Nachtragsmanagement.Core.Plugins;
 using GreenTree.Nachtragsmanagement.Web.Framework.Mvc.Routes;
 using System.Web.Routing;
+using GreenTree.Nachtragsmanagement.Core.Authentication;
 
 namespace GreenTree.Nachtragsmanagement.Web.Framework
 {
@@ -103,6 +104,8 @@ namespace GreenTree.Nachtragsmanagement.Web.Framework
             builder.RegisterType<ConfigurationService>().As<IConfigurationService>();
             builder.RegisterType<DbRelationService>().As<IDbRelationService>();
             builder.RegisterType<UserService>().As<IUserService>();
+            builder.RegisterType<UserHelper>().As<IUserHelper>();
+            builder.RegisterType<AuthenticationService>().As<IAuthenticationService>();
             builder.RegisterType<SiteService>().As<ISiteService>();
             builder.RegisterType<DeviationService>().As<IDeviationService>();
             builder.RegisterType<MiscService>().As<IMiscService>();
@@ -121,9 +124,21 @@ namespace GreenTree.Nachtragsmanagement.Web.Framework
 
             _appContainer = builder.Build();
 
-            DependencyResolver.SetResolver(new AutofacDependencyResolver(_appContainer));
-
             Singleton<IContainer>.Instance = _appContainer;
+
+            // Register plugin controllers in a new container builder
+            var pluginsControllerBuilder = new ContainerBuilder();
+            var pluginsFinder = _appContainer.Resolve<IPluginFinder>();
+            var pluginsInstalled = pluginsFinder.GetPlugins<IPlugin>(LoadPluginsMode.InstalledOnly);
+
+            foreach (var plugin in pluginsInstalled)
+            {
+                pluginsControllerBuilder.RegisterControllers(plugin.PluginDescriptor.ReferencedAssembly);
+            }
+
+            pluginsControllerBuilder.Update(_appContainer);
+
+            DependencyResolver.SetResolver(new AutofacDependencyResolver(_appContainer));
         }
 
         /// <summary>

+ 63 - 0
GreenTree.Nachtragsmanagement.Web.Framework/Authorization/RoleAuthorizeAttribute.cs

@@ -0,0 +1,63 @@
+using Autofac;
+using GreenTree.Nachtragsmanagement.Core;
+using GreenTree.Nachtragsmanagement.Core.Authentication;
+using GreenTree.Nachtragsmanagement.Services.User;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web;
+using System.Web.Mvc;
+
+namespace GreenTree.Nachtragsmanagement.Web.Framework.Authorization
+{
+    public class RoleAuthorizeAttribute : AuthorizeAttribute
+    {
+        #region Fields
+
+        private readonly IAuthenticationService _authenticationService;
+        private readonly IUserHelper _userHelper;
+        private readonly string[] _allowedFunctions;
+
+        #endregion
+
+        /// <summary>
+        /// Initializes a new instance of the RoleAuthorizeAttribute class
+        /// </summary>
+        /// <param name="functions">The functions needed.</param>
+        public RoleAuthorizeAttribute(params string[] functions)
+        {
+            _allowedFunctions = functions;
+
+            _authenticationService = Singleton<IContainer>.Instance.Resolve<IAuthenticationService>();
+            _userHelper = Singleton<IContainer>.Instance.Resolve<IUserHelper>();
+        }
+
+        protected override bool AuthorizeCore(HttpContextBase httpContext)
+        {
+            var user = _userHelper.FromCookies();
+
+            if (user == null)
+                return false;
+
+            foreach (var role in user.Roles)
+            {
+                foreach (var function in role.Functions)
+                {
+                    var allowed = _allowedFunctions.Contains(function.Description);
+
+                    if (allowed)
+                        return true;
+                }
+            }
+
+            return false;
+        }
+
+        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
+        {
+            filterContext.Result = new RedirectResult("~/login");
+        }
+    }
+}

+ 9 - 7
GreenTree.Nachtragsmanagement.Web.Framework/GreenTree.Nachtragsmanagement.Web.Framework.csproj

@@ -45,22 +45,22 @@
     <Reference Include="System.Core" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.Helpers.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll</HintPath>
     </Reference>
-    <Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.1.0\lib\net45\System.Web.Mvc.dll</HintPath>
+    <Reference Include="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.0\lib\net45\System.Web.Mvc.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Razor.3.1.0\lib\net45\System.Web.Razor.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
     </Reference>
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
@@ -71,6 +71,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ApplicationContext.cs" />
+    <Compile Include="Authorization\RoleAuthorizeAttribute.cs" />
     <Compile Include="Mvc\Routes\GuidConstraint.cs" />
     <Compile Include="Mvc\Routes\IRouteProvider.cs" />
     <Compile Include="Mvc\Routes\IRoutePublisher.cs" />
@@ -81,6 +82,7 @@
     <Folder Include="Configuration\" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="app.config" />
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>

+ 11 - 0
GreenTree.Nachtragsmanagement.Web.Framework/app.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 3 - 3
GreenTree.Nachtragsmanagement.Web.Framework/packages.config

@@ -2,8 +2,8 @@
 <packages>
   <package id="Autofac" version="4.0.1" targetFramework="net452" />
   <package id="Autofac.Mvc5" version="4.0.2" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Mvc" version="5.1.0" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Razor" version="3.1.0" targetFramework="net452" />
-  <package id="Microsoft.AspNet.WebPages" version="3.1.0" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Mvc" version="5.2.0" targetFramework="net452" />
+  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net452" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
 </packages>

+ 6 - 3
GreenTree.Nachtragsmanagement.Web/App_Start/FilterConfig.cs

@@ -1,9 +1,12 @@
 using System.Web;
 using System.Web.Mvc;
 
-namespace GreenTree.Nachtragsmanagement.Web {
-    public class FilterConfig {
-        public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
+namespace GreenTree.Nachtragsmanagement.Web
+{
+    public class FilterConfig
+    {
+        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
+        {
             filters.Add(new HandleErrorAttribute());
         }
     }

+ 6 - 3
GreenTree.Nachtragsmanagement.Web/App_Start/RouteConfig.cs

@@ -5,9 +5,12 @@ using System.Web;
 using System.Web.Mvc;
 using System.Web.Routing;
 
-namespace GreenTree.Nachtragsmanagement.Web {
-    public class RouteConfig {
-        public static void RegisterRoutes(RouteCollection routes) {
+namespace GreenTree.Nachtragsmanagement.Web
+{
+    public class RouteConfig
+    {
+        public static void RegisterRoutes(RouteCollection routes)
+        {
             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
             routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
 

+ 6 - 3
GreenTree.Nachtragsmanagement.Web/App_Start/WebApiConfig.cs

@@ -3,9 +3,12 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Web.Http;
 
-namespace GreenTree.Nachtragsmanagement.Web {
-    public static class WebApiConfig {
-        public static void Register(HttpConfiguration config) {
+namespace GreenTree.Nachtragsmanagement.Web
+{
+    public static class WebApiConfig
+    {
+        public static void Register(HttpConfiguration config)
+        {
             config.Routes.MapHttpRoute(
                 name: "DefaultApi",
                 routeTemplate: "api/{controller}/{id}",

+ 33 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/AuthController.cs

@@ -0,0 +1,33 @@
+using GreenTree.Nachtragsmanagement.Services.User;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace GreenTree.Nachtragsmanagement.Web.Controllers
+{
+    public abstract class AuthController : Controller
+    {
+        private readonly IAuthenticationService _authenticationService;
+        private readonly IUserService _userService;
+
+        public AuthController(
+            IAuthenticationService authenticationService,
+            IUserService userService)
+        {
+            _authenticationService = authenticationService;
+            _userService = userService;
+
+            Authenticate();
+        }
+
+        /// <summary>
+        /// Authenticates the current
+        /// </summary>
+        public void Authenticate()
+        {
+
+        }
+    }
+}

+ 4 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/HomeController.cs

@@ -12,9 +12,11 @@ using GreenTree.Nachtragsmanagement.Web.Models.User;
 using Newtonsoft.Json;
 using GreenTree.Nachtragsmanagement.Core.Plugins;
 using GreenTree.Nachtragsmanagement.Core;
+using GreenTree.Nachtragsmanagement.Web.Framework.Authorization;
 
 namespace GreenTree.Nachtragsmanagement.Web.Controllers
 {
+    [RoleAuthorize("Controller-Home")]
     public class HomeController : Controller
     {
         private readonly IDbRelationService _dbRelationService;
@@ -97,6 +99,8 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
             if (pluginDescriptor.Installed)
                 return RedirectToAction("Plugins");
 
+            var routes = System.Web.Routing.RouteTable.Routes;
+
             pluginDescriptor.Instance().Install();
 
             _webHelper.RestartAppDomain();

+ 55 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/LoginController.cs

@@ -0,0 +1,55 @@
+using GreenTree.Nachtragsmanagement.Core;
+using GreenTree.Nachtragsmanagement.Core.Authentication;
+using GreenTree.Nachtragsmanagement.Services.User;
+using GreenTree.Nachtragsmanagement.Web.Models.Login;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace GreenTree.Nachtragsmanagement.Web.Controllers
+{
+    public class LoginController : Controller
+    {
+        private readonly IUserService _userService;
+        private readonly IUserHelper _userHelper;
+
+        public LoginController(
+            IUserService userService,
+            IUserHelper userHelper)
+        {
+            _userService = userService;
+            _userHelper = userHelper;
+        }
+
+        // GET: Login
+        public ActionResult Index()
+        {
+            var user = _userHelper.FromCookies();
+
+            if (user != null)
+                return RedirectToAction("Index", "Home");
+
+            return View("~/Views/Login/Index.cshtml");
+        }
+
+        [HttpPost]
+        public ActionResult Index(LoginModel model)
+        {
+            var user = _userService.GetUserByCustomNumber(Convert.ToInt32(model.Username));
+
+            if (user == null)
+                return Index();
+
+            var password = StaticHelper.GetMD5Hash(model.Password);
+
+            if (!String.Equals(user.Password, password, StringComparison.InvariantCulture))
+                return Index();
+
+            _userHelper.ToCookies(user, DateTime.Now.AddHours(2));
+
+            return RedirectToAction("Index", "Home");
+        }
+    }
+}

+ 5 - 0
GreenTree.Nachtragsmanagement.Web/GreenTree.Nachtragsmanagement.Web.csproj

@@ -181,6 +181,7 @@
     <Content Include="Views\Home\Relations.cshtml" />
     <Content Include="Views\Home\Plugins.cshtml" />
     <Content Include="Views\Shared\_HeaderNavBar.cshtml" />
+    <Content Include="Views\Login\Index.cshtml" />
     <None Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -194,10 +195,13 @@
     <Compile Include="App_Start\FilterConfig.cs" />
     <Compile Include="App_Start\RouteConfig.cs" />
     <Compile Include="App_Start\WebApiConfig.cs" />
+    <Compile Include="Controllers\AuthController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
+    <Compile Include="Controllers\LoginController.cs" />
     <Compile Include="Global.asax.cs">
       <DependentUpon>Global.asax</DependentUpon>
     </Compile>
+    <Compile Include="Models\Login\LoginModel.cs" />
     <Compile Include="Models\Test\DbRelationModel.cs" />
     <Compile Include="Models\Test\PluginModel.cs" />
     <Compile Include="Models\User\UserModel.cs" />
@@ -205,6 +209,7 @@
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />
+    <Folder Include="Views\Auth\" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\GreenTree.Nachtragsmanagement.Core\GreenTree.Nachtragsmanagement.Core.csproj">

+ 13 - 0
GreenTree.Nachtragsmanagement.Web/Models/Login/LoginModel.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace GreenTree.Nachtragsmanagement.Web.Models.Login
+{
+    public class LoginModel
+    {
+        public string Username { get; set; }
+        public string Password { get; set; }
+    }
+}

BIN
GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/GreenTree.Nachtragsmanagement.Plugin.Test.dll


+ 57 - 11
GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/GreenTree.Nachtragsmanagement.Plugin.Test.dll.config

@@ -1,21 +1,67 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  For more information on how to configure your ASP.NET application, please visit
+  https://go.microsoft.com/fwlink/?LinkId=301880
+  -->
 <configuration>
   <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+    </sectionGroup>
   </configSections>
+  <system.web.webPages.razor>
+    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+    <pages pageBaseType="System.Web.Mvc.WebViewPage">
+      <namespaces>
+        <add namespace="System.Web.Mvc" />
+        <add namespace="System.Web.Mvc.Ajax" />
+        <add namespace="System.Web.Mvc.Html" />
+        <add namespace="System.Web.Routing" />
+        <add namespace="GreenTree.Nachtragsmanagement.Plugin.Test" />
+      </namespaces>
+    </pages>
+  </system.web.webPages.razor>
+  <appSettings>
+    <add key="webpages:Version" value="3.0.0.0"/>
+    <add key="webpages:Enabled" value="false"/>
+    <add key="ClientValidationEnabled" value="true"/>
+    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
+  </appSettings>
+  <system.web>
+    <compilation debug="true" targetFramework="4.5.2"/>
+    <httpRuntime targetFramework="4.5.2"/>
+  </system.web>
+  <system.webServer>
+    <handlers>
+      <remove name="BlockViewHandler"/>
+      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
+    </handlers>
+  </system.webServer>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
-        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
+        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
-  <entityFramework>
-    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
-    <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
-    </providers>
-  </entityFramework>
-</configuration>
+  <system.codedom>
+    <compilers>
+      <compiler language="c#;cs;csharp" extension=".cs"
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
+    </compilers>
+  </system.codedom>
+</configuration>

+ 12 - 0
GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/Views/Home/Index.cshtml

@@ -0,0 +1,12 @@
+@{
+    ViewBag.Title = "Index";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Plugin (GreenTree.Nachtragsmanagement.Plugin.Test) - Home</h2>
+
+@Html.Partial("~/Views/Shared/_HeaderNavBar.cshtml")
+
+<h5>
+	Läuft
+</h5>

+ 72 - 0
GreenTree.Nachtragsmanagement.Web/Plugins/Misc.Test/Web.config

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  For more information on how to configure your ASP.NET application, please visit
+  https://go.microsoft.com/fwlink/?LinkId=301880
+  -->
+<configuration>
+  <configSections>
+    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+    </sectionGroup>
+  </configSections>
+  <system.web.webPages.razor>
+    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+    <pages pageBaseType="System.Web.Mvc.WebViewPage">
+      <namespaces>
+        <add namespace="System.Web.Mvc" />
+        <add namespace="System.Web.Mvc.Ajax" />
+        <add namespace="System.Web.Mvc.Html" />
+        <add namespace="System.Web.Routing" />
+        <add namespace="GreenTree.Nachtragsmanagement.Plugin.Test" />
+      </namespaces>
+    </pages>
+  </system.web.webPages.razor>
+  <appSettings>
+    <add key="webpages:Version" value="3.0.0.0"/>
+    <add key="webpages:Enabled" value="false"/>
+    <add key="ClientValidationEnabled" value="true"/>
+    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
+  </appSettings>
+  <system.web>
+    <compilation debug="true" targetFramework="4.5.2"/>
+    <httpRuntime targetFramework="4.5.2"/>
+<!--     <compilation>
+      <assemblies>
+        <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+      </assemblies>
+    </compilation> -->
+  </system.web>
+  <system.webServer>
+    <handlers>
+      <remove name="BlockViewHandler"/>
+      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
+    </handlers>
+  </system.webServer>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
+        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <system.codedom>
+    <compilers>
+      <compiler language="c#;cs;csharp" extension=".cs"
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
+    </compilers>
+  </system.codedom>
+</configuration>

+ 17 - 0
GreenTree.Nachtragsmanagement.Web/Views/Login/Index.cshtml

@@ -0,0 +1,17 @@
+@{
+    ViewBag.Title = "Index";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@model GreenTree.Nachtragsmanagement.Web.Models.Login.LoginModel
+
+<h2>Login</h2>
+
+@using (Html.BeginForm())
+{
+	<h5>Benutzername:</h5>
+	@Html.EditorFor(m => m.Username)
+	<h5>Passwort</h5>
+	@Html.PasswordFor(m => m.Password)
+	<input type="submit" value="Login" />
+}

+ 3 - 1
GreenTree.Nachtragsmanagement.Web/Web.config

@@ -28,9 +28,11 @@
     <add key="vs:EnableBrowserLink" value="false" />
   </appSettings>
   <appendixSectionGroup>
-    <appendixConfigSection>
+    <appendixConfigSection iisAnonymousUser="IUSR">
       <mailServer smtpServer="localhost" port="25" username="" domain="" password="" useSsl="false">
       </mailServer>
+      <ldapServer ldapServer="" administriveUser="" password="">
+      </ldapServer>
     </appendixConfigSection>
   </appendixSectionGroup>
   <system.web>

+ 6 - 6
GreenTree.Nachtragsmanagement.sln

@@ -19,7 +19,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenTree.Nachtragsmanageme
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenTree.Nachtragsmanagement.Web", "GreenTree.Nachtragsmanagement.Web\GreenTree.Nachtragsmanagement.Web.csproj", "{1C75D2AF-A273-4C14-BB2A-6F4659E57816}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenTree.Nachtragsmanagement.Plugin.Test", "GreenTree.Nachtragsmanagement.Plugin.Test\GreenTree.Nachtragsmanagement.Plugin.Test.csproj", "{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenTree.Nachtragsmanagement.Plugin.Test", "GreenTree.Nachtragsmanagement.Plugin.Test\GreenTree.Nachtragsmanagement.Plugin.Test.csproj", "{F60F0134-7C08-4535-8D06-227AA0DC7FC5}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -47,10 +47,10 @@ Global
 		{1C75D2AF-A273-4C14-BB2A-6F4659E57816}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{1C75D2AF-A273-4C14-BB2A-6F4659E57816}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{1C75D2AF-A273-4C14-BB2A-6F4659E57816}.Release|Any CPU.Build.0 = Release|Any CPU
-		{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{702A7197-9C1F-4D47-8EF0-DB27E97CD66F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F60F0134-7C08-4535-8D06-227AA0DC7FC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F60F0134-7C08-4535-8D06-227AA0DC7FC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F60F0134-7C08-4535-8D06-227AA0DC7FC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F60F0134-7C08-4535-8D06-227AA0DC7FC5}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -61,6 +61,6 @@ Global
 		{0C45ECBC-6AD6-4EB1-89BB-F05A3F0FDA13} = {FE55B9AA-2B14-4D78-880E-19BB7AB5394E}
 		{FAFF64EA-DE01-40BF-B805-DE48D4CBEF1C} = {1C471DB6-6627-4D80-A291-9B757CEE2B06}
 		{1C75D2AF-A273-4C14-BB2A-6F4659E57816} = {1C471DB6-6627-4D80-A291-9B757CEE2B06}
-		{702A7197-9C1F-4D47-8EF0-DB27E97CD66F} = {3474D228-B960-467A-8088-082732C575A3}
+		{F60F0134-7C08-4535-8D06-227AA0DC7FC5} = {3474D228-B960-467A-8088-082732C575A3}
 	EndGlobalSection
 EndGlobal