diff --git a/bitwarden-core.sln b/bitwarden-core.sln index 978b161d5..62c8d6288 100644 --- a/bitwarden-core.sln +++ b/bitwarden-core.sln @@ -47,7 +47,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Events", "src\Events\Events EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scim", "src\Scim\Scim.csproj", "{B8C5FFEB-186A-46FF-B914-BB3D50AA8D61}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventsProcessor", "src\EventsProcessor\EventsProcessor.csproj", "{2235D24F-E607-47F4-81AD-BB4504ADF9C6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventsProcessor", "src\EventsProcessor\EventsProcessor.csproj", "{2235D24F-E607-47F4-81AD-BB4504ADF9C6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin", "src\Admin\Admin.csproj", "{B131CEF3-89FB-4C90-ADB0-9E9C4246EB56}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -113,6 +115,10 @@ Global {2235D24F-E607-47F4-81AD-BB4504ADF9C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2235D24F-E607-47F4-81AD-BB4504ADF9C6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2235D24F-E607-47F4-81AD-BB4504ADF9C6}.Release|Any CPU.Build.0 = Release|Any CPU + {B131CEF3-89FB-4C90-ADB0-9E9C4246EB56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B131CEF3-89FB-4C90-ADB0-9E9C4246EB56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B131CEF3-89FB-4C90-ADB0-9E9C4246EB56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B131CEF3-89FB-4C90-ADB0-9E9C4246EB56}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -132,6 +138,7 @@ Global {994DD611-F266-4BD3-8072-3B1B57267ED5} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} {B8C5FFEB-186A-46FF-B914-BB3D50AA8D61} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} {2235D24F-E607-47F4-81AD-BB4504ADF9C6} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} + {B131CEF3-89FB-4C90-ADB0-9E9C4246EB56} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E01CBF68-2E20-425F-9EDB-E0A6510CA92F} diff --git a/src/Admin/Admin.csproj b/src/Admin/Admin.csproj new file mode 100644 index 000000000..954ef5be9 --- /dev/null +++ b/src/Admin/Admin.csproj @@ -0,0 +1,30 @@ + + + + 1.17.2 + netcoreapp2.0 + Bit.Billing + bitwarden-Admin + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Admin/Controllers/HomeController.cs b/src/Admin/Controllers/HomeController.cs new file mode 100644 index 000000000..afa28d86b --- /dev/null +++ b/src/Admin/Controllers/HomeController.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.AspNetCore.Mvc; +using Bit.Admin.Models; + +namespace Bit.Admin.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Error() + { + return View(new ErrorViewModel + { + RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier + }); + } + } +} diff --git a/src/Admin/Models/ErrorViewModel.cs b/src/Admin/Models/ErrorViewModel.cs new file mode 100644 index 000000000..54717ed20 --- /dev/null +++ b/src/Admin/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace Bit.Admin.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} diff --git a/src/Admin/Program.cs b/src/Admin/Program.cs new file mode 100644 index 000000000..0f2e22083 --- /dev/null +++ b/src/Admin/Program.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; + +namespace Bit.Admin +{ + public class Program + { + public static void Main(string[] args) + { + WebHost + .CreateDefaultBuilder(args) + .UseStartup() + .Build() + .Run(); + } + } +} diff --git a/src/Admin/Properties/launchSettings.json b/src/Admin/Properties/launchSettings.json new file mode 100644 index 000000000..541af8e76 --- /dev/null +++ b/src/Admin/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:62911/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Admin": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:62912/" + } + } +} diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs new file mode 100644 index 000000000..e37e5f585 --- /dev/null +++ b/src/Admin/Startup.cs @@ -0,0 +1,41 @@ +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace Bit.Admin +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + public void ConfigureServices(IServiceCollection services) + { + services.AddMvc(); + services.Configure(options => options.LowercaseUrls = true); + } + + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if(env.IsDevelopment()) + { + app.UseBrowserLink(); + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/home/error"); + } + + app.UseStaticFiles(); + app.UseMvcWithDefaultRoute(); + } + } +} diff --git a/src/Admin/Views/Home/Index.cshtml b/src/Admin/Views/Home/Index.cshtml new file mode 100644 index 000000000..57b73aa87 --- /dev/null +++ b/src/Admin/Views/Home/Index.cshtml @@ -0,0 +1,5 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +Home page. diff --git a/src/Admin/Views/Shared/Error.cshtml b/src/Admin/Views/Shared/Error.cshtml new file mode 100644 index 000000000..086796acf --- /dev/null +++ b/src/Admin/Views/Shared/Error.cshtml @@ -0,0 +1,22 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if(Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/src/Admin/Views/Shared/_Layout.cshtml b/src/Admin/Views/Shared/_Layout.cshtml new file mode 100644 index 000000000..f2cbc0ae0 --- /dev/null +++ b/src/Admin/Views/Shared/_Layout.cshtml @@ -0,0 +1,27 @@ + + + + + + @ViewData["Title"] - Bitwarden Admin Portal + + + + + + + + + + @RenderBody() + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/Admin/Views/_ViewImports.cshtml b/src/Admin/Views/_ViewImports.cshtml new file mode 100644 index 000000000..2e7bb7c18 --- /dev/null +++ b/src/Admin/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using Bit.Admin +@using Bit.Admin.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/Admin/Views/_ViewStart.cshtml b/src/Admin/Views/_ViewStart.cshtml new file mode 100644 index 000000000..a5f10045d --- /dev/null +++ b/src/Admin/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/Admin/appsettings.Development.json b/src/Admin/appsettings.Development.json new file mode 100644 index 000000000..fa8ce71a9 --- /dev/null +++ b/src/Admin/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/Admin/appsettings.json b/src/Admin/appsettings.json new file mode 100644 index 000000000..5fff67bac --- /dev/null +++ b/src/Admin/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +} diff --git a/src/Admin/bundleconfig.json b/src/Admin/bundleconfig.json new file mode 100644 index 000000000..6d3f9a57a --- /dev/null +++ b/src/Admin/bundleconfig.json @@ -0,0 +1,24 @@ +// Configure bundling and minification for the project. +// More info at https://go.microsoft.com/fwlink/?LinkId=808241 +[ + { + "outputFileName": "wwwroot/css/site.min.css", + // An array of relative input file paths. Globbing patterns supported + "inputFiles": [ + "wwwroot/css/site.css" + ] + }, + { + "outputFileName": "wwwroot/js/site.min.js", + "inputFiles": [ + "wwwroot/js/site.js" + ], + // Optionally specify minification options + "minify": { + "enabled": true, + "renameLocals": true + }, + // Optionally generate .map file + "sourceMap": false + } +] diff --git a/src/Admin/wwwroot/css/site.css b/src/Admin/wwwroot/css/site.css new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/src/Admin/wwwroot/css/site.css @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Admin/wwwroot/favicon.ico b/src/Admin/wwwroot/favicon.ico new file mode 100644 index 000000000..a3a799985 Binary files /dev/null and b/src/Admin/wwwroot/favicon.ico differ diff --git a/src/Admin/wwwroot/js/site.js b/src/Admin/wwwroot/js/site.js new file mode 100644 index 000000000..0f3411a45 --- /dev/null +++ b/src/Admin/wwwroot/js/site.js @@ -0,0 +1 @@ +// Write your JavaScript code. diff --git a/src/Billing/Billing.csproj b/src/Billing/Billing.csproj index e47448c39..b36115e4c 100644 --- a/src/Billing/Billing.csproj +++ b/src/Billing/Billing.csproj @@ -17,7 +17,6 @@ - diff --git a/src/Billing/Startup.cs b/src/Billing/Startup.cs index 4e9414895..142787bd4 100644 --- a/src/Billing/Startup.cs +++ b/src/Billing/Startup.cs @@ -13,7 +13,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Bit.Billing.Utilities; using Bit.Core.Identity; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Routing; namespace Bit.Billing