From e519a0903aea338f579c147008e6e07b2e549ee1 Mon Sep 17 00:00:00 2001 From: Austin Waters Date: Sun, 24 Sep 2017 21:53:34 -0500 Subject: [PATCH 1/5] Setup Generic Service Registration --- .../SimpleInjector/ServicesContainer.cs | 30 +++++++++++++++++++ .../SimpleInjectorWebApiInitializer.cs | 20 ++++++------- EduApi.Web/EduApi.Web.csproj | 7 +++-- 3 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs rename EduApi.Web/App_Start/{ => SimpleInjector}/SimpleInjectorWebApiInitializer.cs (73%) diff --git a/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs b/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs new file mode 100644 index 0000000..7cb11a9 --- /dev/null +++ b/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs @@ -0,0 +1,30 @@ +using System.Linq; +using System.Reflection; +using SimpleInjector; + +namespace EduApi.Web.SimpleInjector +{ + public class ServicesContainer + { + /// Registers service dependancies + public static void Register (Container container) + { + var types = Assembly.GetExecutingAssembly().GetTypes(); + + var servicesToRegister = ( + from interfaceType in types.Where(t => t.Name.StartsWith("I") && t.Name.EndsWith("Service")) + from serviceType in + types.Where(t => t.Name == interfaceType.Name.Substring(1) && t.Namespace == interfaceType.Namespace) + select new + { + InterfaceType = interfaceType, + ServiceType = serviceType + } + ); + foreach (var pair in servicesToRegister) + { + container.Register(pair.InterfaceType, pair.ServiceType); + } + } + } +} \ No newline at end of file diff --git a/EduApi.Web/App_Start/SimpleInjectorWebApiInitializer.cs b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs similarity index 73% rename from EduApi.Web/App_Start/SimpleInjectorWebApiInitializer.cs rename to EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs index 3174e2d..471779d 100644 --- a/EduApi.Web/App_Start/SimpleInjectorWebApiInitializer.cs +++ b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs @@ -1,14 +1,13 @@ +using System.Web.Http; using EduApi.Web.Data; -using EduApi.Web.Services; +using EduApi.Web.SimpleInjector; +using SimpleInjector; +using SimpleInjector.Integration.WebApi; using SimpleInjector.Lifestyles; -[assembly: WebActivator.PostApplicationStartMethod(typeof(EduApi.Web.App_Start.SimpleInjectorWebApiInitializer), "Initialize")] -namespace EduApi.Web.App_Start +[assembly: WebActivator.PostApplicationStartMethod(typeof(SimpleInjectorWebApiInitializer), "Initialize")] +namespace EduApi.Web.SimpleInjector { - using System.Web.Http; - using SimpleInjector; - using SimpleInjector.Integration.WebApi; - public static class SimpleInjectorWebApiInitializer { /// Initialize the container and register it as Web API Dependency Resolver. @@ -16,7 +15,9 @@ public static void Initialize() { var container = new Container(); container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle(); - + + ServicesContainer.Register(container); + InitializeContainer(container); container.RegisterWebApiControllers(GlobalConfiguration.Configuration); @@ -29,12 +30,11 @@ public static void Initialize() private static void InitializeContainer(Container container) { - container.Register(); - container.Register(Lifestyle.Scoped); // For instance: // container.Register(Lifestyle.Scoped); } + } } \ No newline at end of file diff --git a/EduApi.Web/EduApi.Web.csproj b/EduApi.Web/EduApi.Web.csproj index 5edd80b..62b7e02 100644 --- a/EduApi.Web/EduApi.Web.csproj +++ b/EduApi.Web/EduApi.Web.csproj @@ -16,7 +16,7 @@ EduApi.Web EduApi.Web v4.6.1 - false + true @@ -127,7 +127,8 @@ - + + @@ -186,7 +187,7 @@ True 56621 / - http://localhost/EduApi.Web + http://localhost:56621/ False False From f75bc3903094f83ab619c148c5bd467c552c4f59 Mon Sep 17 00:00:00 2001 From: Austin Waters Date: Mon, 25 Sep 2017 11:44:37 -0500 Subject: [PATCH 2/5] Converted to Owin Hosted --- EduApi.Web.Tests/app.config | 4 ++++ .../SimpleInjectorWebApiInitializer.cs | 9 +++++--- EduApi.Web/App_Start/SwaggerConfig.cs | 6 ++--- EduApi.Web/App_Start/WebApiConfig.cs | 3 ++- EduApi.Web/EduApi.Web.csproj | 21 ++++++++++++++---- EduApi.Web/Global.asax | 1 - EduApi.Web/Global.asax.cs | 17 -------------- EduApi.Web/Startup.cs | 22 +++++++++++++++++++ EduApi.Web/Web.config | 6 ++++- EduApi.Web/packages.config | 4 ++++ 10 files changed, 62 insertions(+), 31 deletions(-) delete mode 100644 EduApi.Web/Global.asax delete mode 100644 EduApi.Web/Global.asax.cs create mode 100644 EduApi.Web/Startup.cs diff --git a/EduApi.Web.Tests/app.config b/EduApi.Web.Tests/app.config index 226df75..3ff8a04 100644 --- a/EduApi.Web.Tests/app.config +++ b/EduApi.Web.Tests/app.config @@ -18,6 +18,10 @@ + + + + diff --git a/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs index 471779d..0df0b18 100644 --- a/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs +++ b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs @@ -1,17 +1,18 @@ +using System; using System.Web.Http; using EduApi.Web.Data; using EduApi.Web.SimpleInjector; +using Owin; using SimpleInjector; using SimpleInjector.Integration.WebApi; using SimpleInjector.Lifestyles; -[assembly: WebActivator.PostApplicationStartMethod(typeof(SimpleInjectorWebApiInitializer), "Initialize")] namespace EduApi.Web.SimpleInjector { public static class SimpleInjectorWebApiInitializer { /// Initialize the container and register it as Web API Dependency Resolver. - public static void Initialize() + public static void Initialize(HttpConfiguration httpConfiguration) { var container = new Container(); container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle(); @@ -20,12 +21,14 @@ public static void Initialize() InitializeContainer(container); - container.RegisterWebApiControllers(GlobalConfiguration.Configuration); + container.RegisterWebApiControllers(httpConfiguration); container.Verify(); GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container); + + httpConfiguration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container); } private static void InitializeContainer(Container container) diff --git a/EduApi.Web/App_Start/SwaggerConfig.cs b/EduApi.Web/App_Start/SwaggerConfig.cs index 8ce31e7..9b69cb0 100644 --- a/EduApi.Web/App_Start/SwaggerConfig.cs +++ b/EduApi.Web/App_Start/SwaggerConfig.cs @@ -3,17 +3,15 @@ using EduApi.Web; using Swashbuckle.Application; -[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] - namespace EduApi.Web { public class SwaggerConfig { - public static void Register() + public static void Register(HttpConfiguration configuration) { var thisAssembly = typeof(SwaggerConfig).Assembly; - GlobalConfiguration.Configuration + configuration .EnableSwagger(c => { // By default, the service root url is inferred from the request used to access the docs. diff --git a/EduApi.Web/App_Start/WebApiConfig.cs b/EduApi.Web/App_Start/WebApiConfig.cs index 0b8c048..34b3f89 100644 --- a/EduApi.Web/App_Start/WebApiConfig.cs +++ b/EduApi.Web/App_Start/WebApiConfig.cs @@ -3,12 +3,13 @@ using System.Linq; using System.Web.Http; using System.Web.Http.Cors; +using Owin; namespace EduApi.Web { public static class WebApiConfig { - public static void Register(HttpConfiguration config) + public static void Register(IAppBuilder app, HttpConfiguration config) { /* Web API configuration and services */ diff --git a/EduApi.Web/EduApi.Web.csproj b/EduApi.Web/EduApi.Web.csproj index 62b7e02..46c5c6d 100644 --- a/EduApi.Web/EduApi.Web.csproj +++ b/EduApi.Web/EduApi.Web.csproj @@ -57,10 +57,22 @@ True + + ..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll + True + + + ..\packages\Microsoft.Owin.Host.SystemWeb.3.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll True + + ..\packages\Owin.1.0\lib\net40\Owin.dll + True + ..\packages\SimpleInjector.4.0.6\lib\net45\SimpleInjector.dll True @@ -91,6 +103,10 @@ ..\packages\Microsoft.AspNet.WebApi.Cors.5.2.3\lib\net45\System.Web.Http.Cors.dll True + + ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll + True + @@ -122,7 +138,6 @@ - @@ -136,9 +151,6 @@ - - Global.asax - 201705152259561_Initial.cs @@ -151,6 +163,7 @@ + diff --git a/EduApi.Web/Global.asax b/EduApi.Web/Global.asax deleted file mode 100644 index fe04ae8..0000000 --- a/EduApi.Web/Global.asax +++ /dev/null @@ -1 +0,0 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="EduApi.Web.WebApiApplication" Language="C#" %> diff --git a/EduApi.Web/Global.asax.cs b/EduApi.Web/Global.asax.cs deleted file mode 100644 index 2f7335b..0000000 --- a/EduApi.Web/Global.asax.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Http; -using System.Web.Routing; - -namespace EduApi.Web -{ - public class WebApiApplication : System.Web.HttpApplication - { - protected void Application_Start() - { - GlobalConfiguration.Configure(WebApiConfig.Register); - } - } -} diff --git a/EduApi.Web/Startup.cs b/EduApi.Web/Startup.cs new file mode 100644 index 0000000..4295bd5 --- /dev/null +++ b/EduApi.Web/Startup.cs @@ -0,0 +1,22 @@ +using System.Web.Http; +using EduApi.Web; +using EduApi.Web.SimpleInjector; +using Microsoft.Owin; +using Owin; +using SimpleInjector.Integration.WebApi; + +[assembly: OwinStartup(typeof(Startup))] +namespace EduApi.Web +{ public class Startup + { + public void Configuration(IAppBuilder appBuilder) + { + var httpConfiguration = new HttpConfiguration(); + WebApiConfig.Register(appBuilder, httpConfiguration); + appBuilder.UseWebApi(httpConfiguration); + + SimpleInjectorWebApiInitializer.Initialize(httpConfiguration); + SwaggerConfig.Register(httpConfiguration); + } + } +} \ No newline at end of file diff --git a/EduApi.Web/Web.config b/EduApi.Web/Web.config index 2c27010..d0dfc53 100644 --- a/EduApi.Web/Web.config +++ b/EduApi.Web/Web.config @@ -10,7 +10,7 @@ - + @@ -50,6 +50,10 @@ + + + + diff --git a/EduApi.Web/packages.config b/EduApi.Web/packages.config index 6ad44ae..ef0509c 100644 --- a/EduApi.Web/packages.config +++ b/EduApi.Web/packages.config @@ -6,11 +6,15 @@ + + + + From 9c03d841508f34efe076dc217a0d4f2d258f9f78 Mon Sep 17 00:00:00 2001 From: Austin Waters Date: Mon, 25 Sep 2017 12:17:47 -0500 Subject: [PATCH 3/5] Added option to host as a console app --- EduApi.Console/App.config | 47 ++++++++++++ EduApi.Console/EduApi.Console.csproj | 93 +++++++++++++++++++++++ EduApi.Console/Program.cs | 23 ++++++ EduApi.Console/Properties/AssemblyInfo.cs | 36 +++++++++ EduApi.Console/packages.config | 8 ++ EduApi.Web.sln | 6 ++ 6 files changed, 213 insertions(+) create mode 100644 EduApi.Console/App.config create mode 100644 EduApi.Console/EduApi.Console.csproj create mode 100644 EduApi.Console/Program.cs create mode 100644 EduApi.Console/Properties/AssemblyInfo.cs create mode 100644 EduApi.Console/packages.config diff --git a/EduApi.Console/App.config b/EduApi.Console/App.config new file mode 100644 index 0000000..13bd080 --- /dev/null +++ b/EduApi.Console/App.config @@ -0,0 +1,47 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/EduApi.Console/EduApi.Console.csproj b/EduApi.Console/EduApi.Console.csproj new file mode 100644 index 0000000..2841c19 --- /dev/null +++ b/EduApi.Console/EduApi.Console.csproj @@ -0,0 +1,93 @@ + + + + + Debug + AnyCPU + {5E881637-B84B-4A8F-BD67-00784E3EB6E9} + Exe + Properties + EduApi.Console + EduApi.Console + v4.6.1 + 512 + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll + True + + + ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll + True + + + ..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll + True + + + ..\packages\Microsoft.Owin.Host.HttpListener.3.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll + True + + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll + True + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + True + + + + + + + + + + + + + + + + + + + + + + + {66013134-bc6d-40bd-8b51-90456d6add2f} + EduApi.Web + + + + + \ No newline at end of file diff --git a/EduApi.Console/Program.cs b/EduApi.Console/Program.cs new file mode 100644 index 0000000..700f407 --- /dev/null +++ b/EduApi.Console/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Configuration; +using System.Diagnostics; +using EduApi.Web; +using Microsoft.Owin.Hosting; + +namespace EduApi.Console +{ + class Program + { + static void Main(string[] args) + { + var baseAddress = ConfigurationManager.AppSettings["BaseAddress"]; + + using (WebApp.Start(baseAddress)) + { + Process.Start(baseAddress); + System.Console.WriteLine($"Started on {baseAddress}..."); + System.Console.ReadKey(); + } + } + } +} diff --git a/EduApi.Console/Properties/AssemblyInfo.cs b/EduApi.Console/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f39227d --- /dev/null +++ b/EduApi.Console/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("EduApi.Console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("EduApi.Console")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5e881637-b84b-4a8f-bd67-00784e3eb6e9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/EduApi.Console/packages.config b/EduApi.Console/packages.config new file mode 100644 index 0000000..652e0e8 --- /dev/null +++ b/EduApi.Console/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/EduApi.Web.sln b/EduApi.Web.sln index dee94ef..97d3071 100644 --- a/EduApi.Web.sln +++ b/EduApi.Web.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduApi.Web", "EduApi.Web\Ed EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduApi.Web.Tests", "EduApi.Web.Tests\EduApi.Web.Tests.csproj", "{47EFBA67-12DC-4141-AFE6-436F3E2A09DE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduApi.Console", "EduApi.Console\EduApi.Console.csproj", "{5E881637-B84B-4A8F-BD67-00784E3EB6E9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {47EFBA67-12DC-4141-AFE6-436F3E2A09DE}.Debug|Any CPU.Build.0 = Debug|Any CPU {47EFBA67-12DC-4141-AFE6-436F3E2A09DE}.Release|Any CPU.ActiveCfg = Release|Any CPU {47EFBA67-12DC-4141-AFE6-436F3E2A09DE}.Release|Any CPU.Build.0 = Release|Any CPU + {5E881637-B84B-4A8F-BD67-00784E3EB6E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E881637-B84B-4A8F-BD67-00784E3EB6E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E881637-B84B-4A8F-BD67-00784E3EB6E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E881637-B84B-4A8F-BD67-00784E3EB6E9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 1c80588fb0afb8bd3a1d20ca644b5c43aba64f6f Mon Sep 17 00:00:00 2001 From: Austin Waters Date: Mon, 25 Sep 2017 14:07:28 -0500 Subject: [PATCH 4/5] Created JWT Token Provider and Supporting Providers --- EduApi.Console/App.config | 16 ++- EduApi.Web.Tests/app.config | 10 +- .../App_Start/SimpleInjector/BaseContainer.cs | 32 +++++ .../SimpleInjector/ServicesContainer.cs | 30 ----- .../SimpleInjectorWebApiInitializer.cs | 15 ++- EduApi.Web/EduApi.Web.csproj | 33 ++++- .../Providers/ApplicationSettingsProvider.cs | 21 +++ .../HMACSHA256SigningCredentialsProvider.cs | 28 ++++ .../ISigningCredentialsProvider.cs | 10 ++ .../RSASigningCredentialsProvider.cs | 41 ++++++ EduApi.Web/Providers/JWTTokenProvider.cs | 78 +++++++++++ EduApi.Web/Providers/RSAProvider.cs | 127 ++++++++++++++++++ EduApi.Web/Startup.cs | 1 + EduApi.Web/Web.config | 18 ++- EduApi.Web/packages.config | 5 +- EduApi.Web/rsaKey.json | 1 + 16 files changed, 425 insertions(+), 41 deletions(-) create mode 100644 EduApi.Web/App_Start/SimpleInjector/BaseContainer.cs delete mode 100644 EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs create mode 100644 EduApi.Web/Providers/ApplicationSettingsProvider.cs create mode 100644 EduApi.Web/Providers/JWTSigningCredentialsProviders/HMACSHA256SigningCredentialsProvider.cs create mode 100644 EduApi.Web/Providers/JWTSigningCredentialsProviders/ISigningCredentialsProvider.cs create mode 100644 EduApi.Web/Providers/JWTSigningCredentialsProviders/RSASigningCredentialsProvider.cs create mode 100644 EduApi.Web/Providers/JWTTokenProvider.cs create mode 100644 EduApi.Web/Providers/RSAProvider.cs create mode 100644 EduApi.Web/rsaKey.json diff --git a/EduApi.Console/App.config b/EduApi.Console/App.config index 13bd080..5676d6e 100644 --- a/EduApi.Console/App.config +++ b/EduApi.Console/App.config @@ -6,6 +6,12 @@ + + + + + + @@ -26,12 +32,20 @@ - + + + + + + + + + diff --git a/EduApi.Web.Tests/app.config b/EduApi.Web.Tests/app.config index 3ff8a04..2f86961 100644 --- a/EduApi.Web.Tests/app.config +++ b/EduApi.Web.Tests/app.config @@ -12,7 +12,7 @@ - + @@ -22,6 +22,14 @@ + + + + + + + + diff --git a/EduApi.Web/App_Start/SimpleInjector/BaseContainer.cs b/EduApi.Web/App_Start/SimpleInjector/BaseContainer.cs new file mode 100644 index 0000000..9752022 --- /dev/null +++ b/EduApi.Web/App_Start/SimpleInjector/BaseContainer.cs @@ -0,0 +1,32 @@ +using System.Linq; +using System.Reflection; +using SimpleInjector; + +namespace EduApi.Web.SimpleInjector +{ + public class BaseContainer + { + /// registers dependancies based on naming conventions + public static void Register (Container container, string endsWith) + { + var types = Assembly.GetExecutingAssembly().GetTypes(); + + var typesToRegister = ( + from serviceType in types.Where(t => t.Name.StartsWith("I") && t.Name.EndsWith(endsWith)) + from implementationType in + types.Where(t => t.Name == serviceType.Name.Substring(1) && t.Namespace == serviceType.Namespace) + select new + { + ServiceType = serviceType, + ImplementationType = implementationType + } + ); + foreach (var pair in typesToRegister) + { + // Checks if the service has already been registered. Allows for custom installations + if(container.GetCurrentRegistrations().All(x => x.ServiceType != pair.ServiceType)) + container.Register(pair.ServiceType, pair.ImplementationType, Lifestyle.Scoped); + } + } + } +} \ No newline at end of file diff --git a/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs b/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs deleted file mode 100644 index 7cb11a9..0000000 --- a/EduApi.Web/App_Start/SimpleInjector/ServicesContainer.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Linq; -using System.Reflection; -using SimpleInjector; - -namespace EduApi.Web.SimpleInjector -{ - public class ServicesContainer - { - /// Registers service dependancies - public static void Register (Container container) - { - var types = Assembly.GetExecutingAssembly().GetTypes(); - - var servicesToRegister = ( - from interfaceType in types.Where(t => t.Name.StartsWith("I") && t.Name.EndsWith("Service")) - from serviceType in - types.Where(t => t.Name == interfaceType.Name.Substring(1) && t.Namespace == interfaceType.Namespace) - select new - { - InterfaceType = interfaceType, - ServiceType = serviceType - } - ); - foreach (var pair in servicesToRegister) - { - container.Register(pair.InterfaceType, pair.ServiceType); - } - } - } -} \ No newline at end of file diff --git a/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs index 0df0b18..80e5adc 100644 --- a/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs +++ b/EduApi.Web/App_Start/SimpleInjector/SimpleInjectorWebApiInitializer.cs @@ -1,6 +1,10 @@ using System; +using System.Configuration; using System.Web.Http; using EduApi.Web.Data; +using EduApi.Web.Providers; +using EduApi.Web.Providers.JWTSigningCredentialsProviders; +using EduApi.Web.Services; using EduApi.Web.SimpleInjector; using Owin; using SimpleInjector; @@ -17,10 +21,12 @@ public static void Initialize(HttpConfiguration httpConfiguration) var container = new Container(); container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle(); - ServicesContainer.Register(container); - InitializeContainer(container); + // Installs based on convention i.e. IUserService, UserService + BaseContainer.Register(container, "Provider"); + BaseContainer.Register(container, "Service"); + container.RegisterWebApiControllers(httpConfiguration); container.Verify(); @@ -31,8 +37,13 @@ public static void Initialize(HttpConfiguration httpConfiguration) httpConfiguration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container); } + //Custom Installations not overridden by the base installation private static void InitializeContainer(Container container) { + var useRsa = ConfigurationManager.AppSettings["JWT.UseRsa"]; + if(useRsa == "true") container.Register(Lifestyle.Scoped); + else container.Register(Lifestyle.Scoped); + container.Register(Lifestyle.Scoped); // For instance: diff --git a/EduApi.Web/EduApi.Web.csproj b/EduApi.Web/EduApi.Web.csproj index 46c5c6d..940f820 100644 --- a/EduApi.Web/EduApi.Web.csproj +++ b/EduApi.Web/EduApi.Web.csproj @@ -57,6 +57,14 @@ True + + ..\packages\Microsoft.IdentityModel.Logging.1.1.2\lib\net451\Microsoft.IdentityModel.Logging.dll + True + + + ..\packages\Microsoft.IdentityModel.Tokens.5.1.2\lib\net451\Microsoft.IdentityModel.Tokens.dll + True + ..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll True @@ -69,6 +77,10 @@ ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + ..\packages\Owin.1.0\lib\net40\Owin.dll True @@ -85,6 +97,11 @@ ..\packages\Swashbuckle.Core.5.5.3\lib\net40\Swashbuckle.Core.dll True + + + ..\packages\System.IdentityModel.Tokens.Jwt.5.1.0\lib\net451\System.IdentityModel.Tokens.Jwt.dll + True + ..\packages\Microsoft.AspNet.Cors.5.2.3\lib\net45\System.Web.Cors.dll @@ -124,9 +141,6 @@ - - ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll @@ -139,10 +153,12 @@ - + + Designer + - + @@ -162,11 +178,18 @@ + + + + + + + Web.config diff --git a/EduApi.Web/Providers/ApplicationSettingsProvider.cs b/EduApi.Web/Providers/ApplicationSettingsProvider.cs new file mode 100644 index 0000000..ec09815 --- /dev/null +++ b/EduApi.Web/Providers/ApplicationSettingsProvider.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Web; + +namespace EduApi.Web.Providers +{ + public interface IApplicationSettingsProvider + { + string GetValue(string key); + } + + public class ApplicationSettingsProvider : IApplicationSettingsProvider + { + public string GetValue(string key) + { + return ConfigurationManager.AppSettings[key]; + } + } +} \ No newline at end of file diff --git a/EduApi.Web/Providers/JWTSigningCredentialsProviders/HMACSHA256SigningCredentialsProvider.cs b/EduApi.Web/Providers/JWTSigningCredentialsProviders/HMACSHA256SigningCredentialsProvider.cs new file mode 100644 index 0000000..2f5d0c9 --- /dev/null +++ b/EduApi.Web/Providers/JWTSigningCredentialsProviders/HMACSHA256SigningCredentialsProvider.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Web; +using Microsoft.IdentityModel.Tokens; + +namespace EduApi.Web.Providers.JWTSigningCredentialsProviders +{ + public class HMACSHA256SigningCredentialsProvider : ISigningCredentialsProvider + { + private IApplicationSettingsProvider _appSettings; + public HMACSHA256SigningCredentialsProvider(IApplicationSettingsProvider appSettings) + { + _appSettings = appSettings; + } + + public SigningCredentials GetSigningCredentials() + { + var hmacKey = _appSettings.GetValue("JWT.HmacSecretKey"); + var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(hmacKey)); + return new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256); + } + + } +} \ No newline at end of file diff --git a/EduApi.Web/Providers/JWTSigningCredentialsProviders/ISigningCredentialsProvider.cs b/EduApi.Web/Providers/JWTSigningCredentialsProviders/ISigningCredentialsProvider.cs new file mode 100644 index 0000000..3628735 --- /dev/null +++ b/EduApi.Web/Providers/JWTSigningCredentialsProviders/ISigningCredentialsProvider.cs @@ -0,0 +1,10 @@ +using Microsoft.IdentityModel.Tokens; + + +namespace EduApi.Web.Providers +{ + public interface ISigningCredentialsProvider + { + SigningCredentials GetSigningCredentials(); + } +} \ No newline at end of file diff --git a/EduApi.Web/Providers/JWTSigningCredentialsProviders/RSASigningCredentialsProvider.cs b/EduApi.Web/Providers/JWTSigningCredentialsProviders/RSASigningCredentialsProvider.cs new file mode 100644 index 0000000..7ed8785 --- /dev/null +++ b/EduApi.Web/Providers/JWTSigningCredentialsProviders/RSASigningCredentialsProvider.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Web; +using Microsoft.IdentityModel.Tokens; + +namespace EduApi.Web.Providers.JWTSigningCredentialsProviders +{ + public class RSASigningCredentialsProvider : ISigningCredentialsProvider + { + private IApplicationSettingsProvider _appSettings; + private readonly IRSAProvider _rsaProvider; + public RSASigningCredentialsProvider(IApplicationSettingsProvider appSettings, IRSAProvider rsaProvider) + { + _appSettings = appSettings; + _rsaProvider = rsaProvider; + } + + public SigningCredentials GetSigningCredentials() + { + var key = GetSecurityKey(); + return new SigningCredentials(key, SecurityAlgorithms.RsaSha256Signature); + } + private RsaSecurityKey GetSecurityKey() + { + Directory.GetCurrentDirectory(); + var rsaJsonFileName = _appSettings.GetValue("JWT.RsaJsonFileName"); + var keyParameters = _rsaProvider.GetKeyParameters(rsaJsonFileName); + + const int dwKeySize = 2048; + var provider = new RSACryptoServiceProvider(dwKeySize); + provider.ImportParameters(keyParameters); + + var key = new RsaSecurityKey(provider); + return key; + } + } + +} \ No newline at end of file diff --git a/EduApi.Web/Providers/JWTTokenProvider.cs b/EduApi.Web/Providers/JWTTokenProvider.cs new file mode 100644 index 0000000..c398b2b --- /dev/null +++ b/EduApi.Web/Providers/JWTTokenProvider.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IdentityModel.Tokens.Jwt; +using System.IO; +using System.Security.Claims; +using System.Security.Cryptography; +using Microsoft.IdentityModel.Tokens; + + +namespace EduApi.Web.Providers +{ + public interface ISecurityTokenProvider + { + ClaimsPrincipal GetClaimsPrincipal(string tokenString); + string GetToken(IEnumerable claims, int expirationMinutes = 1); + } + + public class JWTTokenProvider : ISecurityTokenProvider + { + private readonly IApplicationSettingsProvider _appSettings; + private readonly ISigningCredentialsProvider _signingCredentialsProvider; + + public JWTTokenProvider(IApplicationSettingsProvider appSettings, ISigningCredentialsProvider signingCredentialsProvider) + { + _appSettings = appSettings; + _signingCredentialsProvider = signingCredentialsProvider; + } + + public ClaimsPrincipal GetClaimsPrincipal(string tokenString) + { + var issuer = _appSettings.GetValue("JWT.Issuer"); + var appliesToAddress = _appSettings.GetValue("JWT.Audience"); + var signingCredentials = _signingCredentialsProvider.GetSigningCredentials(); + + var validationParameters = new TokenValidationParameters + { + ValidIssuers = new [] { issuer }, + ValidAudience = appliesToAddress, + IssuerSigningKey = signingCredentials.Key + }; + + var handler = new JwtSecurityTokenHandler(); + SecurityToken securityToken; + var principal = handler.ValidateToken(tokenString, validationParameters, out securityToken); + + return principal; + } + + public string GetToken(IEnumerable claims, int expirationMinutes = 1) + { + var identity = new ClaimsIdentity(claims); + + var appliesToAddress = _appSettings.GetValue("JWT.Audience"); + var issuer = _appSettings.GetValue("JWT.Issuer"); + var expires = DateTime.Now.AddMinutes(expirationMinutes); + + var securityTokenDescriptor = new SecurityTokenDescriptor + { + Issuer = issuer, + Audience = appliesToAddress, + SigningCredentials = _signingCredentialsProvider.GetSigningCredentials(), + Subject = identity, + Expires = expires, + }; + + var handler = new JwtSecurityTokenHandler() + { + TokenLifetimeInMinutes = expirationMinutes, + SetDefaultTimesOnTokenCreation = false + }; + var securityToken = handler.CreateToken(securityTokenDescriptor); + + return handler.WriteToken(securityToken); + } + } + +} \ No newline at end of file diff --git a/EduApi.Web/Providers/RSAProvider.cs b/EduApi.Web/Providers/RSAProvider.cs new file mode 100644 index 0000000..22639dd --- /dev/null +++ b/EduApi.Web/Providers/RSAProvider.cs @@ -0,0 +1,127 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using Newtonsoft.Json; + + +namespace EduApi.Web.Providers +{ + public interface IRSAProvider + { + RSAParameters GetRandomKey(); + void GenerateKeyAndSave(string file); + + /// + /// This expects a file in the format: + /// { + /// "Modulus": "z7eXmrs9z3Xm7VXwYIdziDYzXGfi3XQiozIRa58m3ApeLVDcsDeq6Iv8C5zJ2DHydDyc0x6o5dtTRIb23r5/ZRj4I/UwbgrwMk5iHA0bVsXVPBDSWsrVcPDGafr6YbUNQnNWIF8xOqgpeTwxrqGiCJMUjuKyUx01PBzpBxjpnQ++Ryz6Y7MLqKHxBkDiOw5wk9cxO8/IMspSNJJosOtRXFTR74+bj+pvNBa8IJ+5Jf/UfJEEjk+qC+pohCAryRk0ziXcPdxXEv5KGT4zf3LdtHy1YwsaGLnTb62vgbdqqCJaVyHWOoXsDTQBLjxNl9o9CzP6CrfBGK6JV8pA/xfQlw==", + /// "Exponent": "AQAB", + /// "P": "+VsETS2exORYlg2CxaRMzyG60dTfHSuv0CsfmO3PFv8mcYxglGa6bUV5VGtB6Pd1HdtV/iau1WR/hYXQphCP99Pu803NZvFvVi34alTFbh0LMfZ+2iQ9toGzVfO8Qdbj7go4TWoHNzCpG4UCx/9wicVIWJsNzkppSEcXYigADMM=", + /// "Q": "1UCJ2WAHasiCdwJtV2Ep0VCK3Z4rVFLWg3q1v5OoOU1CkX5/QAcrr6bX6zOdHR1bDCPsH1n1E9cCMvwakgi9M4Ch0dYF5CxDKtlx+IGsZJL0gB6HhcEsHat+yXUtOAlS4YB82G1hZqiDw+Q0O8LGyu/gLDPB+bn0HmbkUC2kP50=", + /// "DP": "CBqvLxr2eAu73VSfFXFblbfQ7JTwk3AiDK/6HOxNuL+eLj6TvP8BvB9v7BB4WewBAHFqgBIdyI21n09UErGjHDjlIT88F8ZtCe4AjuQmboe/H2aVhN18q/vXKkn7qmAjlE78uXdiuKZ6OIzAJGPm8nNZAJg5gKTmexTka6pFJiU=", + /// "DQ": "ND6zhwX3yzmEfROjJh0v2ZAZ9WGiy+3fkCaoEF9kf2VmQa70DgOzuDzv+TeT7mYawEasuqGXYVzztPn+qHhrogqJmpcMqnINopnTSka6rYkzTZAtM5+35yz0yvZiNbBTFdwcuglSK4xte7iU828stNs/2JR1mXDtVeVvWhVUgCE=", + /// "InverseQ": "Heo0BHv685rvWreFcI5MXSy3AN0Zs0YbwAYtZZd1K/OzFdYVdOnqw+Dg3wGU9yFD7h4icJFwZUBGOZ0ww/gZX/5ZgJK35/YY/DeV+qfZmywKauUzC6+DPsrDdW1uf1eAety6/huRZTduBFTwIOlPdZ+PY49j6S38DjPFNImn0cU=", + /// "D": "IvjMI5cGzxkQqkDf2cC0aOiHOTWccqCM/GD/odkH1+A+/u4wWdLliYWYB/R731R5d6yE0t7EnP6SRGVcxx/XnxPXI2ayorRgwHeF+ScTxUZFonlKkVK5IOzI2ysQYMb01o1IoOamCTQq12iVDMvV1g+9VFlCoM+4GMjdSv6cxn6ELabuD4nWt8tCskPjECThO+WdrknbUTppb2rRgMvNKfsPuF0H7+g+WisbzVS+UVRvJe3U5O5X5j7Z82Uq6hw2NCwv2YhQZRo/XisFZI7yZe0OU2JkXyNG3NCk8CgsM9yqX8Sk5esXMZdJzjwXtEpbR7FiKZXiz9LhPSmzxz/VsQ==" + /// } + /// + /// Generate + /// + /// + /// + RSAParameters GetKeyParameters(string file); + } + + public class RSAProvider : IRSAProvider + { + public RSAParameters GetRandomKey() + { + using (var rsa = new RSACryptoServiceProvider(2048)) + { + try + { + return rsa.ExportParameters(true); + } + finally + { + rsa.PersistKeyInCsp = false; + } + } + } + + public void GenerateKeyAndSave(string file) + { + var p = GetRandomKey(); + RSAParametersWithPrivate t = new RSAParametersWithPrivate(); + t.SetParameters(p); + File.WriteAllText(file, JsonConvert.SerializeObject(t)); + } + + /// + /// This expects a file in the format: + /// { + /// "Modulus": "z7eXmrs9z3Xm7VXwYIdziDYzXGfi3XQiozIRa58m3ApeLVDcsDeq6Iv8C5zJ2DHydDyc0x6o5dtTRIb23r5/ZRj4I/UwbgrwMk5iHA0bVsXVPBDSWsrVcPDGafr6YbUNQnNWIF8xOqgpeTwxrqGiCJMUjuKyUx01PBzpBxjpnQ++Ryz6Y7MLqKHxBkDiOw5wk9cxO8/IMspSNJJosOtRXFTR74+bj+pvNBa8IJ+5Jf/UfJEEjk+qC+pohCAryRk0ziXcPdxXEv5KGT4zf3LdtHy1YwsaGLnTb62vgbdqqCJaVyHWOoXsDTQBLjxNl9o9CzP6CrfBGK6JV8pA/xfQlw==", + /// "Exponent": "AQAB", + /// "P": "+VsETS2exORYlg2CxaRMzyG60dTfHSuv0CsfmO3PFv8mcYxglGa6bUV5VGtB6Pd1HdtV/iau1WR/hYXQphCP99Pu803NZvFvVi34alTFbh0LMfZ+2iQ9toGzVfO8Qdbj7go4TWoHNzCpG4UCx/9wicVIWJsNzkppSEcXYigADMM=", + /// "Q": "1UCJ2WAHasiCdwJtV2Ep0VCK3Z4rVFLWg3q1v5OoOU1CkX5/QAcrr6bX6zOdHR1bDCPsH1n1E9cCMvwakgi9M4Ch0dYF5CxDKtlx+IGsZJL0gB6HhcEsHat+yXUtOAlS4YB82G1hZqiDw+Q0O8LGyu/gLDPB+bn0HmbkUC2kP50=", + /// "DP": "CBqvLxr2eAu73VSfFXFblbfQ7JTwk3AiDK/6HOxNuL+eLj6TvP8BvB9v7BB4WewBAHFqgBIdyI21n09UErGjHDjlIT88F8ZtCe4AjuQmboe/H2aVhN18q/vXKkn7qmAjlE78uXdiuKZ6OIzAJGPm8nNZAJg5gKTmexTka6pFJiU=", + /// "DQ": "ND6zhwX3yzmEfROjJh0v2ZAZ9WGiy+3fkCaoEF9kf2VmQa70DgOzuDzv+TeT7mYawEasuqGXYVzztPn+qHhrogqJmpcMqnINopnTSka6rYkzTZAtM5+35yz0yvZiNbBTFdwcuglSK4xte7iU828stNs/2JR1mXDtVeVvWhVUgCE=", + /// "InverseQ": "Heo0BHv685rvWreFcI5MXSy3AN0Zs0YbwAYtZZd1K/OzFdYVdOnqw+Dg3wGU9yFD7h4icJFwZUBGOZ0ww/gZX/5ZgJK35/YY/DeV+qfZmywKauUzC6+DPsrDdW1uf1eAety6/huRZTduBFTwIOlPdZ+PY49j6S38DjPFNImn0cU=", + /// "D": "IvjMI5cGzxkQqkDf2cC0aOiHOTWccqCM/GD/odkH1+A+/u4wWdLliYWYB/R731R5d6yE0t7EnP6SRGVcxx/XnxPXI2ayorRgwHeF+ScTxUZFonlKkVK5IOzI2ysQYMb01o1IoOamCTQq12iVDMvV1g+9VFlCoM+4GMjdSv6cxn6ELabuD4nWt8tCskPjECThO+WdrknbUTppb2rRgMvNKfsPuF0H7+g+WisbzVS+UVRvJe3U5O5X5j7Z82Uq6hw2NCwv2YhQZRo/XisFZI7yZe0OU2JkXyNG3NCk8CgsM9yqX8Sk5esXMZdJzjwXtEpbR7FiKZXiz9LhPSmzxz/VsQ==" + /// } + /// + /// Generate + /// + /// + /// + public RSAParameters GetKeyParameters(string file) + { + if (!File.Exists(file)) throw new FileNotFoundException("Check configuration - cannot find auth key file: " + file); + var keyParams = JsonConvert.DeserializeObject(File.ReadAllText(file)); + return keyParams.ToRSAParameters(); + } + + /// + /// Util class to allow restoring RSA parameters from JSON as the normal + /// RSA parameters class won't restore private key info. + /// + private class RSAParametersWithPrivate + { + public byte[] D { get; set; } + public byte[] DP { get; set; } + public byte[] DQ { get; set; } + public byte[] Exponent { get; set; } + public byte[] InverseQ { get; set; } + public byte[] Modulus { get; set; } + public byte[] P { get; set; } + public byte[] Q { get; set; } + + public void SetParameters(RSAParameters p) + { + D = p.D; + DP = p.DP; + DQ = p.DQ; + Exponent = p.Exponent; + InverseQ = p.InverseQ; + Modulus = p.Modulus; + P = p.P; + Q = p.Q; + } + public RSAParameters ToRSAParameters() + { + return new RSAParameters() + { + D = this.D, + DP = this.DP, + DQ = this.DQ, + Exponent = this.Exponent, + InverseQ = this.InverseQ, + Modulus = this.Modulus, + P = this.P, + Q = this.Q + + }; + } + } + } + +} \ No newline at end of file diff --git a/EduApi.Web/Startup.cs b/EduApi.Web/Startup.cs index 4295bd5..3aa7b88 100644 --- a/EduApi.Web/Startup.cs +++ b/EduApi.Web/Startup.cs @@ -1,5 +1,6 @@ using System.Web.Http; using EduApi.Web; +using EduApi.Web.Providers; using EduApi.Web.SimpleInjector; using Microsoft.Owin; using Owin; diff --git a/EduApi.Web/Web.config b/EduApi.Web/Web.config index d0dfc53..4d699b6 100644 --- a/EduApi.Web/Web.config +++ b/EduApi.Web/Web.config @@ -4,6 +4,14 @@ http://go.microsoft.com/fwlink/?LinkId=301879 --> + + + + + + + +
@@ -45,7 +53,7 @@ - + @@ -55,6 +63,14 @@ + + + + + + + + diff --git a/EduApi.Web/packages.config b/EduApi.Web/packages.config index ef0509c..0312eac 100644 --- a/EduApi.Web/packages.config +++ b/EduApi.Web/packages.config @@ -9,17 +9,20 @@ + + - + + \ No newline at end of file diff --git a/EduApi.Web/rsaKey.json b/EduApi.Web/rsaKey.json new file mode 100644 index 0000000..1a3bea6 --- /dev/null +++ b/EduApi.Web/rsaKey.json @@ -0,0 +1 @@ +{"D":"Sl3JZYLBe5aZLBmdEPmlySbRgnePraWYpji1EyARaHMa5d7jcz1PuUP3UCLe75U9BeB+UMNlkptSFet4KnmXyvbpYJwdhnwoYOKOV9zvKCPzV2nJMYL8iBvxvkyQreQF1b+iJDiXaFpqyExHLW9JI46E/bf2ejsWbZFcGqeY1seyQ3Upbw0RXXy1jFegSWE9zPcrlq/X1Acr4cqDrfUylZmMAfujiPeSfLfvSUsR02e3YtkGhPVdPtsB+10iUwYolRpzZ+pAs3GYEngO5lM9vGR3PsX8ETS2YlbIikIRV7MmFOYAgRXR9N7aGNgB+/FWpgWKHLVri94fMjOqA3Kz4Q==","DP":"fwgt9tvKCJNgvq8wUsDCD2aT8JzElEslOPvZQqSGtn0jYmosCfN8nfGlNKX2aXhK/4wdn3afnweczjhMr6CtrW0VluNUjIAIoJ/aECTNP6V5SeB3LLPHaWHlQ8fffQHbtfKuTI6KPttTYpWdngGHfEwlCC3i06TUTqlbBHRQsMc=","DQ":"HGV5ZHwfRmxK9127fy0ep87KK+khZVzY47IF8orpyhB69DjG0gFVJTITC6hALDrG+1DMfqNWSDOKnf0aGJH9mx8SnDXI2rZv+zSo4qmpoHbnxlwgJmEmFnR2Rt7v/VA4bHnKuuoP/NE5LpcHRTg7RW+j7BHVcKbLx7vMtNQ/Z4U=","Exponent":"AQAB","InverseQ":"anKqDoLKoixe99kTs/nNRFzaopAvy2eP1xCs/iScaHMSTRlE/+nGaf1XBaoBwcaBQpfaHcoMTLMk8m26+wp1MMxQaZ+Oxsd/EGjMjbveUxq5w5SQ0IPicdPCcWpHCst42yGm/oqwdJImwxv+rZx16wYVdfpn9MTu9HY0qsWWAak=","Modulus":"yFW821cI0l+uihbTaQvw4GVMycwqe6LKqxLkQo79et7IcxjDfrQDmtnfCyKW4adnaMgQAgnU9ij2VP+6MNg0k/rTi+KvS8hCThGAfQvGeOtT4an4tfaNCfBG/V9eT4Sgjih9pC9u4PSrFo0VvLjELQjCwm4nweO4tDu0Bm/U4Z9fdPoFVVzF0nFOyNGYEm1jNCVhfkEyxx2b6AXGhl/c3HGjuHfhc7Os0YvjXBRRFf7jZf0tWWRUW0uSzaJEU9u9ObJelG4A7HBEDvQPk5+GWwYs15Tyr1bXiYROuH0uWmLtqmafnHR/FIlJj79BoxVMI+HALmU1lYGcgsgycf86LQ==","P":"1wHWg4Mn/qkdd6jGnokIgoopIXpq/iCNJBlFN84vef/Jn/kdKegSC5yBi7MyHgU54bom1SPSNQgVq8qSmcbmPG7oBTB9qxmqkmSM+0CLBwhenjjuXKUuEb2L5tTQ7RE21xxv8G3Y20VV2TKckZPOxTcxszVC7/OtEDBoE00GFUc=","Q":"7ofFAKPr3wrfotYo+rRlORMpXcELLBuBO1quUQItLniE+kgnunGAgm9wE8ugVe7pbaadFfqEi7VH6KDpzup7JcGVI+jN0FVmXK6x0cC/bhG59HJmUx9zBrYyYKN/hBvAGtjtc5cYtBzPGpWvKLx9Imq/4CoMjNZXwcZD4ETpvus="} \ No newline at end of file From 429773531d7f7d66e232083080109d07d272ba73 Mon Sep 17 00:00:00 2001 From: Austin Waters Date: Mon, 25 Sep 2017 15:13:34 -0500 Subject: [PATCH 5/5] WIP --- EduApi.Console/App.config | 10 +++++----- EduApi.Console/EduApi.Console.csproj | 3 +++ EduApi.Web/EduApi.Web.csproj | 8 ++++++++ EduApi.Web/Startup.cs | 4 ++++ EduApi.Web/Web.config | 10 +++++----- EduApi.Web/packages.config | 2 ++ 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/EduApi.Console/App.config b/EduApi.Console/App.config index 5676d6e..3b53180 100644 --- a/EduApi.Console/App.config +++ b/EduApi.Console/App.config @@ -7,11 +7,11 @@ - - - - - + + + + + diff --git a/EduApi.Console/EduApi.Console.csproj b/EduApi.Console/EduApi.Console.csproj index 2841c19..39c6745 100644 --- a/EduApi.Console/EduApi.Console.csproj +++ b/EduApi.Console/EduApi.Console.csproj @@ -83,6 +83,9 @@ + + xcopy "$(SolutionDir)EduApi.Web/index.html" "$(TargetDir)" /Y /I + - - - - - + + + + + diff --git a/EduApi.Web/packages.config b/EduApi.Web/packages.config index 0312eac..7683325 100644 --- a/EduApi.Web/packages.config +++ b/EduApi.Web/packages.config @@ -13,7 +13,9 @@ + +