From 965148bdd61a9eb0b8f996a9920695ce9927ac07 Mon Sep 17 00:00:00 2001 From: khanhna Date: Fri, 26 Feb 2021 20:49:34 +0700 Subject: [PATCH] Add simple authentication feature --- sample/AppSettings.cs | 7 +- sample/Pages/Privacy.cshtml.cs | 7 +- sample/Pages/Shared/_Layout.cshtml | 2 +- sample/Startup.cs | 22 +-- .../ApplicationBuilderExtensions.cs | 135 ++++++++++++------ .../Controllers/AuthenticateController.cs | 110 ++++++++++++++ .../Controllers/CalendarsController.cs | 12 +- .../Controllers/ExecutionsController.cs | 4 +- .../Controllers/HistoryController.cs | 4 +- .../Controllers/JobDataMapController.cs | 4 +- .../Controllers/JobsController.cs | 4 +- .../Controllers/PageControllerBase.cs | 4 +- .../Controllers/SchedulerController.cs | 4 +- .../Controllers/TriggersController.cs | 4 +- .../SilkierQuartzAuthenticationMiddleware.cs | 108 ++++++++++++++ .../Models/AuthenticateViewModel.cs | 16 +++ .../SilkierQuartzAuthenticateOptions.cs | 14 ++ src/SilkierQuartz/SilkierQuartzOptions.cs | 6 + .../Views/Authenticate/Login.hbs | 44 ++++++ src/SilkierQuartz/Views/Layout.hbs | 23 +-- 20 files changed, 443 insertions(+), 91 deletions(-) create mode 100644 src/SilkierQuartz/Controllers/AuthenticateController.cs create mode 100644 src/SilkierQuartz/Middlewares/SilkierQuartzAuthenticationMiddleware.cs create mode 100644 src/SilkierQuartz/Models/AuthenticateViewModel.cs create mode 100644 src/SilkierQuartz/SilkierQuartzAuthenticateOptions.cs create mode 100644 src/SilkierQuartz/Views/Authenticate/Login.hbs diff --git a/sample/AppSettings.cs b/sample/AppSettings.cs index d522721..99ab7eb 100644 --- a/sample/AppSettings.cs +++ b/sample/AppSettings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace SilkierQuartz.Example +namespace SilkierQuartz.Example { public class AppSettings { diff --git a/sample/Pages/Privacy.cshtml.cs b/sample/Pages/Privacy.cshtml.cs index 9a6f096..f8c9934 100644 --- a/sample/Pages/Privacy.cshtml.cs +++ b/sample/Pages/Privacy.cshtml.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace SilkierQuartz.Example.Pages diff --git a/sample/Pages/Shared/_Layout.cshtml b/sample/Pages/Shared/_Layout.cshtml index 5dd43f1..1e1b005 100644 --- a/sample/Pages/Shared/_Layout.cshtml +++ b/sample/Pages/Shared/_Layout.cshtml @@ -22,7 +22,7 @@ Home