├── .gitignore ├── LICENSE ├── README.md ├── Synercoding.FormsAuthentication.sln ├── samples ├── TestImplementation.ReadCookie │ ├── .bowerrc │ ├── Controllers │ │ ├── HomeController.cs │ │ └── SecurityController.cs │ ├── FormsAuthHelper.cs │ ├── Models │ │ └── ErrorViewModel.cs │ ├── Program.cs │ ├── Startup.cs │ ├── TestImplementation.ReadCookie.csproj │ ├── Views │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Security │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── bower.json │ ├── bundleconfig.json │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── js │ │ ├── site.js │ │ └── site.min.js │ │ └── lib │ │ ├── bootstrap │ │ ├── .bower.json │ │ ├── CHANGELOG.md │ │ ├── Gemfile │ │ ├── Gemfile.lock │ │ ├── Gruntfile.js │ │ ├── ISSUE_TEMPLATE.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bower.json │ │ ├── dist │ │ │ ├── css │ │ │ │ ├── bootstrap-theme.css │ │ │ │ ├── bootstrap-theme.css.map │ │ │ │ ├── bootstrap-theme.min.css │ │ │ │ ├── bootstrap-theme.min.css.map │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.css.map │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── npm.js │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── grunt │ │ │ ├── .jshintrc │ │ │ ├── .stylelintrc │ │ │ ├── browsers.js │ │ │ ├── bs-commonjs-generator.js │ │ │ ├── bs-glyphicons-data-generator.js │ │ │ ├── bs-lessdoc-parser.js │ │ │ ├── bs-raw-files-generator.js │ │ │ ├── change-version.js │ │ │ ├── configBridge.json │ │ │ ├── generate-sri.js │ │ │ └── karma.conf.js │ │ ├── js │ │ │ ├── .jscsrc │ │ │ ├── .jshintrc │ │ │ ├── affix.js │ │ │ ├── alert.js │ │ │ ├── button.js │ │ │ ├── carousel.js │ │ │ ├── collapse.js │ │ │ ├── dropdown.js │ │ │ ├── modal.js │ │ │ ├── popover.js │ │ │ ├── scrollspy.js │ │ │ ├── tab.js │ │ │ ├── tooltip.js │ │ │ └── transition.js │ │ ├── less │ │ │ ├── alerts.less │ │ │ ├── badges.less │ │ │ ├── bootstrap.less │ │ │ ├── breadcrumbs.less │ │ │ ├── button-groups.less │ │ │ ├── buttons.less │ │ │ ├── carousel.less │ │ │ ├── close.less │ │ │ ├── code.less │ │ │ ├── component-animations.less │ │ │ ├── dropdowns.less │ │ │ ├── forms.less │ │ │ ├── glyphicons.less │ │ │ ├── grid.less │ │ │ ├── input-groups.less │ │ │ ├── jumbotron.less │ │ │ ├── labels.less │ │ │ ├── list-group.less │ │ │ ├── media.less │ │ │ ├── mixins.less │ │ │ ├── mixins │ │ │ │ ├── alerts.less │ │ │ │ ├── background-variant.less │ │ │ │ ├── border-radius.less │ │ │ │ ├── buttons.less │ │ │ │ ├── center-block.less │ │ │ │ ├── clearfix.less │ │ │ │ ├── forms.less │ │ │ │ ├── gradients.less │ │ │ │ ├── grid-framework.less │ │ │ │ ├── grid.less │ │ │ │ ├── hide-text.less │ │ │ │ ├── image.less │ │ │ │ ├── labels.less │ │ │ │ ├── list-group.less │ │ │ │ ├── nav-divider.less │ │ │ │ ├── nav-vertical-align.less │ │ │ │ ├── opacity.less │ │ │ │ ├── pagination.less │ │ │ │ ├── panels.less │ │ │ │ ├── progress-bar.less │ │ │ │ ├── reset-filter.less │ │ │ │ ├── reset-text.less │ │ │ │ ├── resize.less │ │ │ │ ├── responsive-visibility.less │ │ │ │ ├── size.less │ │ │ │ ├── tab-focus.less │ │ │ │ ├── table-row.less │ │ │ │ ├── text-emphasis.less │ │ │ │ ├── text-overflow.less │ │ │ │ └── vendor-prefixes.less │ │ │ ├── modals.less │ │ │ ├── navbar.less │ │ │ ├── navs.less │ │ │ ├── normalize.less │ │ │ ├── pager.less │ │ │ ├── pagination.less │ │ │ ├── panels.less │ │ │ ├── popovers.less │ │ │ ├── print.less │ │ │ ├── progress-bars.less │ │ │ ├── responsive-embed.less │ │ │ ├── responsive-utilities.less │ │ │ ├── scaffolding.less │ │ │ ├── tables.less │ │ │ ├── theme.less │ │ │ ├── thumbnails.less │ │ │ ├── tooltip.less │ │ │ ├── type.less │ │ │ ├── utilities.less │ │ │ ├── variables.less │ │ │ └── wells.less │ │ ├── nuget │ │ │ ├── MyGet.ps1 │ │ │ ├── bootstrap.less.nuspec │ │ │ └── bootstrap.nuspec │ │ ├── package-lock.json │ │ ├── package.js │ │ └── package.json │ │ ├── jquery-validation-unobtrusive │ │ ├── .bower.json │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── .bower.json │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── .bower.json │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map └── TestImplementation.SetCookie │ ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ └── RouteConfig.cs │ ├── ApplicationInsights.config │ ├── Content │ ├── Site.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ └── bootstrap.min.css.map │ ├── Controllers │ └── LoginController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ └── LoginVM.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Scripts │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js │ ├── TestImplementation.SetCookie.csproj │ ├── Views │ ├── Login │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 │ └── packages.config └── src └── Synercoding.FormsAuthentication ├── Encryption ├── AspNetCryptoServiceProvider.cs ├── CryptoAlgorithmFactory.cs ├── CryptoAlgorithms.cs ├── CryptoUtil.cs ├── CryptographicKey.cs ├── HomogenizingCryptoServiceWrapper.cs ├── ICryptoAlgorithmFactory.cs ├── ICryptoService.cs ├── IMasterKeyProvider.cs ├── MasterKeyProvider.cs ├── NetFXCryptoService.cs ├── SerializingBinaryReader.cs └── SerializingBinaryWriter.cs ├── EncryptionMethod.cs ├── FormsAuthenticationCookie.cs ├── FormsAuthenticationCryptor.cs ├── FormsAuthenticationDataFormat.cs ├── FormsAuthenticationOptions.cs ├── Synercoding.FormsAuthentication.csproj └── ValidationMethod.cs /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Gerard Gunnewijk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FormsAuthentication 2 | Enable ASP.NET Core 2 cookies to read old ASP.NET Forms Authentication cookies by implementing a custom `ISecureDataFormat`. 3 | 4 | NuGet: [![NuGet Shield](https://img.shields.io/nuget/dt/Synercoding.FormsAuthentication.svg)](https://www.nuget.org/packages/Synercoding.FormsAuthentication/) 5 | 6 | Usage: 7 | 8 |
var section = Configuration.GetSection("FormsAuthentication");
 9 | 
10 | var faOptions = new FormsAuthenticationOptions()
11 | {
12 |     DecryptionKey = section.GetValue<string>("DecryptionKey"),
13 |     ValidationKey = section.GetValue<string>("ValidationKey"),
14 |     EncryptionMethod = section.GetValue<EncryptionMethod>("EncryptionMethod"),
15 |     ValidationMethod = section.GetValue<ValidationMethod>("ValidationMethod"),
16 | };
17 | 
18 | services
19 |     .AddAuthentication(options =>
20 |     {
21 |         options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
22 |         options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
23 |         options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
24 |     })
25 |     .AddCookie(options =>
26 |     {
27 |         options.Cookie.Name = section.GetValue<string>("CookieName");
28 |         options.AccessDeniedPath = "/Login/Upgrade/";
29 |         options.LoginPath = "/Login/";
30 |         options.ReturnUrlParameter = "returnurl";
31 |         options.TicketDataFormat = new FormsAuthenticationDataFormat<AuthenticationTicket>(
32 |             faOptions,
33 |             FormsAuthHelper.ConvertCookieToTicket,
34 |             FormsAuthHelper.ConvertTicketToCookie
35 |             );
36 |     });
37 | 38 | The `FormsAuthHelper.ConvertCookieToTicket` and `FormsAuthHelper.ConvertTicketToCookie` helper methods convert an ASP.NET Core `AuthenticationTicket` to a `FormsAuthenticationCookie` and vise versa. This class contains the same data as a old ASPNET Cookie. 39 | -------------------------------------------------------------------------------- /Synercoding.FormsAuthentication.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synercoding.FormsAuthentication", "src\Synercoding.FormsAuthentication\Synercoding.FormsAuthentication.csproj", "{121C0FBF-2419-45B9-88DB-705DE22639B0}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BA80AAEB-9E96-4B2A-804A-5F03ED8D846C}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DA8FFBBF-91B4-470A-B813-0CCE8B7A1752}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestImplementation.SetCookie", "samples\TestImplementation.SetCookie\TestImplementation.SetCookie.csproj", "{83A0D43F-E37E-4FF8-833D-4E26F8347749}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestImplementation.ReadCookie", "samples\TestImplementation.ReadCookie\TestImplementation.ReadCookie.csproj", "{D198053D-43F2-4F11-A1A6-B664B955E504}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {121C0FBF-2419-45B9-88DB-705DE22639B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {121C0FBF-2419-45B9-88DB-705DE22639B0}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {121C0FBF-2419-45B9-88DB-705DE22639B0}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {121C0FBF-2419-45B9-88DB-705DE22639B0}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {83A0D43F-E37E-4FF8-833D-4E26F8347749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {83A0D43F-E37E-4FF8-833D-4E26F8347749}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {83A0D43F-E37E-4FF8-833D-4E26F8347749}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {83A0D43F-E37E-4FF8-833D-4E26F8347749}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {D198053D-43F2-4F11-A1A6-B664B955E504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {D198053D-43F2-4F11-A1A6-B664B955E504}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {D198053D-43F2-4F11-A1A6-B664B955E504}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {D198053D-43F2-4F11-A1A6-B664B955E504}.Release|Any CPU.Build.0 = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(NestedProjects) = preSolution 39 | {121C0FBF-2419-45B9-88DB-705DE22639B0} = {BA80AAEB-9E96-4B2A-804A-5F03ED8D846C} 40 | {83A0D43F-E37E-4FF8-833D-4E26F8347749} = {DA8FFBBF-91B4-470A-B813-0CCE8B7A1752} 41 | {D198053D-43F2-4F11-A1A6-B664B955E504} = {DA8FFBBF-91B4-470A-B813-0CCE8B7A1752} 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityGlobals) = postSolution 44 | SolutionGuid = {C5B0C57E-B173-4F4A-97BD-F983391EA099} 45 | EndGlobalSection 46 | EndGlobal 47 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "wwwroot/lib" 3 | } 4 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using TestImplementation.ReadCookie.Models; 4 | 5 | namespace TestImplementation.ReadCookie.Controllers 6 | { 7 | public class HomeController : Controller 8 | { 9 | public IActionResult Index() 10 | { 11 | return View(); 12 | } 13 | 14 | public IActionResult Error() 15 | { 16 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Controllers/SecurityController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authentication; 2 | using Microsoft.AspNetCore.Authentication.Cookies; 3 | using Microsoft.AspNetCore.Authorization; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System.Threading.Tasks; 6 | 7 | namespace TestImplementation.ReadCookie.Controllers 8 | { 9 | [Authorize] 10 | public class SecurityController : Controller 11 | { 12 | public IActionResult Index() 13 | { 14 | return View(); 15 | } 16 | 17 | public async Task Logout() 18 | { 19 | await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); 20 | return RedirectToAction(nameof(Index)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TestImplementation.ReadCookie.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace TestImplementation.ReadCookie 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup() 23 | .Build(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Synercoding.FormsAuthentication; 6 | using Microsoft.AspNetCore.Authentication; 7 | using Microsoft.AspNetCore.Http; 8 | using Microsoft.AspNetCore.Authentication.Cookies; 9 | 10 | namespace TestImplementation.ReadCookie 11 | { 12 | public class Startup 13 | { 14 | public Startup(IConfiguration configuration) 15 | { 16 | Configuration = configuration; 17 | } 18 | 19 | public IConfiguration Configuration { get; } 20 | 21 | // This method gets called by the runtime. Use this method to add services to the container. 22 | public void ConfigureServices(IServiceCollection services) 23 | { 24 | var section = Configuration.GetSection("FormsAuthentication"); 25 | 26 | var faOptions = new FormsAuthenticationOptions() 27 | { 28 | DecryptionKey = section.GetValue("DecryptionKey"), 29 | ValidationKey = section.GetValue("ValidationKey"), 30 | EncryptionMethod = section.GetValue("EncryptionMethod"), 31 | ValidationMethod = section.GetValue("ValidationMethod"), 32 | }; 33 | 34 | services 35 | .AddAuthentication(options => 36 | { 37 | options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; 38 | options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme; 39 | options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; 40 | }) 41 | .AddCookie(options => 42 | { 43 | options.Cookie.Name = section.GetValue("CookieName"); 44 | options.AccessDeniedPath = "/Login/"; 45 | options.LoginPath = "/Login/"; 46 | options.ReturnUrlParameter = "returnurl"; 47 | options.TicketDataFormat = new FormsAuthenticationDataFormat( 48 | faOptions, 49 | FormsAuthHelper.ConvertCookieToTicket, 50 | FormsAuthHelper.ConvertTicketToCookie 51 | ); 52 | options.SlidingExpiration = false; 53 | 54 | options.Events.OnRedirectToAccessDenied = context => FormsAuthHelper.RedirectToAccessDenied(context, section.GetValue("BaseAuthUrl")); 55 | options.Events.OnRedirectToLogin = context => FormsAuthHelper.RedirectToLogin(context, section.GetValue("BaseAuthUrl")); 56 | }); 57 | 58 | services.AddMvc(); 59 | } 60 | 61 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 62 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 63 | { 64 | if (env.IsDevelopment()) 65 | { 66 | app.UseDeveloperExceptionPage(); 67 | } 68 | else 69 | { 70 | app.UseExceptionHandler("/Home/Error"); 71 | } 72 | 73 | app.UseAuthentication(); 74 | 75 | app.UseStaticFiles(); 76 | 77 | app.UseMvcWithDefaultRoute(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/TestImplementation.ReadCookie.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
6 |
7 | @if (User.Identity.IsAuthenticated) 8 | { 9 |

Click security to go to the security page and view your claimsprincipal.

10 | } 11 | else 12 | { 13 |

Click security to go to the security page and be redirected to the login page.

14 | } 15 |
16 |
17 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/Security/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Security information"; 3 | } 4 | 5 |

User data

6 | 7 |

Identity

8 | 9 |

Logoff

10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
PropertyValue
Name@User.Identity.Name
IsAuthenticated@User.Identity.IsAuthenticated
AuthenticationType@User.Identity.AuthenticationType
33 | 34 |

Claims

35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | @foreach (var claim in User.Claims) 47 | { 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | } 56 | 57 |
IssuerOriginalIssuerTypeValueValueType
@claim.Issuer@claim.OriginalIssuer@claim.Type@claim.Value@claim.ValueType
-------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | 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. 22 |

23 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - TestImplementation.ReadCookie 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 39 |
40 | @RenderBody() 41 |
42 |
43 |

© 2017 - TestImplementation.ReadCookie

44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 59 | 65 | 66 | 67 | 68 | @RenderSection("Scripts", required: false) 69 | 70 | 71 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using TestImplementation.ReadCookie 2 | @using TestImplementation.ReadCookie.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | }, 8 | "FormsAuthentication": { 9 | "CookieName": "MyOldFormsCookie", 10 | "BaseAuthUrl": "http://localhost:58442/", 11 | "DecryptionKey": "F6D5A5C8DDEC57481610829F58D6C95BDAC5FA21082F3FA9CB5A36DCEAACBEDB", 12 | "ValidationKey": "F2D27DF0348E9A3EAD6AC66330C31F821394D4CD1A5E139EEE85EA9D9F2A963E55EC87572F699FB834292CC9E37AD56B6B26AA379106CBA5E9AA544C688F3E92", 13 | "EncryptionMethod": "AES", 14 | "ValidationMethod": "SHA1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asp.net", 3 | "private": true, 4 | "dependencies": { 5 | "bootstrap": "v3.4.1", 6 | "jquery": "2.2.0", 7 | "jquery-validation": "1.14.0", 8 | "jquery-validation-unobtrusive": "3.2.6" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Wrapping element */ 7 | /* Set some basic padding to keep content from hitting the edges */ 8 | .body-content { 9 | padding-left: 15px; 10 | padding-right: 15px; 11 | } 12 | 13 | /* Carousel */ 14 | .carousel-caption p { 15 | font-size: 20px; 16 | line-height: 1.4; 17 | } 18 | 19 | /* Make .svg files in the carousel display properly in older browsers */ 20 | .carousel-inner .item img[src$=".svg"] { 21 | width: 100%; 22 | } 23 | 24 | /* QR code generator */ 25 | #qrCode { 26 | margin: 15px; 27 | } 28 | 29 | /* Hide/rearrange for smaller screens */ 30 | @media screen and (max-width: 767px) { 31 | /* Hide captions */ 32 | .carousel-caption { 33 | display: none; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/favicon.ico -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/js/site.min.js -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "https://getbootstrap.com/", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | }, 34 | "version": "3.4.1", 35 | "_release": "3.4.1", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.4.1", 39 | "commit": "68b0d231a13201eb14acd3dc84e51543d16e5f7e" 40 | }, 41 | "_source": "https://github.com/twbs/bootstrap.git", 42 | "_target": "3.4.1", 43 | "_originalSource": "bootstrap" 44 | } -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Bootstrap uses [GitHub's Releases feature](https://blog.github.com/2013-07-02-release-your-software/) for its changelogs. 2 | 3 | See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. 4 | 5 | Release announcement posts on [the official Bootstrap blog](https://blog.getbootstrap.com/) contain summaries of the most noteworthy changes made in each release. 6 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :development, :test do 4 | gem 'jekyll', '~> 3.8.5' 5 | gem 'jekyll-redirect-from', '~> 0.14.0' 6 | gem 'jekyll-sitemap', '~> 1.2.0' 7 | gem 'wdm', '~> 0.1.1', :install_if => Gem.win_platform? 8 | end 9 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.6.0) 5 | public_suffix (>= 2.0.2, < 4.0) 6 | colorator (1.1.0) 7 | concurrent-ruby (1.1.4) 8 | em-websocket (0.5.1) 9 | eventmachine (>= 0.12.9) 10 | http_parser.rb (~> 0.6.0) 11 | eventmachine (1.2.7) 12 | eventmachine (1.2.7-x64-mingw32) 13 | ffi (1.10.0) 14 | ffi (1.10.0-x64-mingw32) 15 | forwardable-extended (2.6.0) 16 | http_parser.rb (0.6.0) 17 | i18n (0.9.5) 18 | concurrent-ruby (~> 1.0) 19 | jekyll (3.8.5) 20 | addressable (~> 2.4) 21 | colorator (~> 1.0) 22 | em-websocket (~> 0.5) 23 | i18n (~> 0.7) 24 | jekyll-sass-converter (~> 1.0) 25 | jekyll-watch (~> 2.0) 26 | kramdown (~> 1.14) 27 | liquid (~> 4.0) 28 | mercenary (~> 0.3.3) 29 | pathutil (~> 0.9) 30 | rouge (>= 1.7, < 4) 31 | safe_yaml (~> 1.0) 32 | jekyll-redirect-from (0.14.0) 33 | jekyll (~> 3.3) 34 | jekyll-sass-converter (1.5.2) 35 | sass (~> 3.4) 36 | jekyll-sitemap (1.2.0) 37 | jekyll (~> 3.3) 38 | jekyll-watch (2.1.2) 39 | listen (~> 3.0) 40 | kramdown (1.17.0) 41 | liquid (4.0.1) 42 | listen (3.1.5) 43 | rb-fsevent (~> 0.9, >= 0.9.4) 44 | rb-inotify (~> 0.9, >= 0.9.7) 45 | ruby_dep (~> 1.2) 46 | mercenary (0.3.6) 47 | pathutil (0.16.2) 48 | forwardable-extended (~> 2.6) 49 | public_suffix (3.0.3) 50 | rb-fsevent (0.10.3) 51 | rb-inotify (0.10.0) 52 | ffi (~> 1.0) 53 | rouge (3.3.0) 54 | ruby_dep (1.5.0) 55 | safe_yaml (1.0.4) 56 | sass (3.7.3) 57 | sass-listen (~> 4.0.0) 58 | sass-listen (4.0.0) 59 | rb-fsevent (~> 0.9, >= 0.9.4) 60 | rb-inotify (~> 0.9, >= 0.9.7) 61 | wdm (0.1.1) 62 | 63 | PLATFORMS 64 | ruby 65 | x64-mingw32 66 | 67 | DEPENDENCIES 68 | jekyll (~> 3.8.5) 69 | jekyll-redirect-from (~> 0.14.0) 70 | jekyll-sitemap (~> 1.2.0) 71 | wdm (~> 0.1.1) 72 | 73 | BUNDLED WITH 74 | 1.17.3 75 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Before opening an issue: 2 | 3 | - [Search for duplicate or closed issues](https://github.com/twbs/bootstrap/issues?utf8=%E2%9C%93&q=is%3Aissue) 4 | - [Validate](https://validator.w3.org/nu/) and [lint](https://github.com/twbs/bootlint#in-the-browser) any HTML to avoid common problems 5 | - Prepare a [reduced test case](https://css-tricks.com/reduced-test-cases/) for any bugs 6 | - Read the [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md) 7 | 8 | When asking general "how to" questions: 9 | 10 | - Please do not open an issue here 11 | - Instead, ask for help on [StackOverflow, IRC, or Slack](https://github.com/twbs/bootstrap/blob/master/README.md#community) 12 | 13 | When reporting a bug, include: 14 | 15 | - Operating system and version (Windows, Mac OS X, Android, iOS, Win10 Mobile) 16 | - Browser and version (Chrome, Firefox, Safari, IE, MS Edge, Opera 15+, Android Browser) 17 | - Reduced test cases and potential fixes using [JS Bin](https://jsbin.com/) 18 | 19 | When suggesting a feature, include: 20 | 21 | - As much detail as possible for what we should add and why it's important to Bootstrap 22 | - Relevant links to prior art, screenshots, or live demos whenever possible 23 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2019 Twitter, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "https://getbootstrap.com/", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends" : "../js/.jshintrc", 3 | "asi" : false, 4 | "browser" : false, 5 | "es3" : false, 6 | "node" : true 7 | } 8 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/browsers.js: -------------------------------------------------------------------------------- 1 | // jscs:disable requireCamelCaseOrUpperCaseIdentifiers 2 | 3 | var browsers = { 4 | safariMac: { 5 | base: 'BrowserStack', 6 | os: 'OS X', 7 | os_version: 'Yosemite', 8 | browser: 'Safari', 9 | browser_version: '8.0' 10 | }, 11 | chromeMac: { 12 | base: 'BrowserStack', 13 | os: 'OS X', 14 | os_version: 'Yosemite', 15 | browser : 'Chrome', 16 | browser_version : 'latest' 17 | }, 18 | firefoxMac: { 19 | base: 'BrowserStack', 20 | os: 'OS X', 21 | os_version: 'Yosemite', 22 | browser: 'Firefox', 23 | browser_version: 'latest' 24 | }, 25 | 'ie11Win8.1': { 26 | base: 'BrowserStack', 27 | os: 'Windows', 28 | os_version: '8.1', 29 | browser: 'IE', 30 | browser_version: '11.0' 31 | }, 32 | ie10Win8: { 33 | base: 'BrowserStack', 34 | os: 'Windows', 35 | os_version: '8', 36 | browser: 'IE', 37 | browser_version: '10.0' 38 | }, 39 | ie9Win7: { 40 | base: 'BrowserStack', 41 | os: 'Windows', 42 | os_version: '7', 43 | browser: 'IE', 44 | browser_version: '9.0' 45 | }, 46 | ie8Win7: { 47 | base: 'BrowserStack', 48 | os: 'Windows', 49 | os_version: '7', 50 | browser: 'IE', 51 | browser_version: '8.0' 52 | }, 53 | 'chromeWin8.1': { 54 | base: 'BrowserStack', 55 | os: 'Windows', 56 | os_version: '8.1', 57 | browser: 'Chrome', 58 | browser_version: 'latest' 59 | }, 60 | 'firefoxWin8.1': { 61 | base: 'BrowserStack', 62 | os: 'Windows', 63 | os_version: '8.1', 64 | browser: 'Firefox', 65 | browser_version: 'latest' 66 | }, 67 | iphone6: { 68 | base: 'BrowserStack', 69 | os: 'ios', 70 | os_version: '11.2', 71 | device: 'iPhone 6', 72 | real_mobile: true 73 | }, 74 | nexus5: { 75 | base: 'BrowserStack', 76 | os: 'android', 77 | os_version: '4.4', 78 | device: 'Google Nexus 5', 79 | real_mobile: true 80 | } 81 | }; 82 | 83 | module.exports = { 84 | list: browsers, 85 | keys: Object.keys(browsers) 86 | }; 87 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/bs-commonjs-generator.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Grunt task for the CommonJS module generation 3 | * https://getbootstrap.com/ 4 | * Copyright 2014-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | var path = require('path'); 12 | 13 | var COMMONJS_BANNER = '// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\n'; 14 | 15 | module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath) { 16 | var destDir = path.dirname(destFilepath); 17 | 18 | function srcPathToDestRequire(srcFilepath) { 19 | var requirePath = path.posix.relative(destDir, srcFilepath); 20 | return 'require(\'' + requirePath + '\')'; 21 | } 22 | 23 | var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(srcPathToDestRequire).join('\n'); 24 | try { 25 | fs.writeFileSync(destFilepath, moduleOutputJs); 26 | } catch (err) { 27 | grunt.fail.warn(err); 28 | } 29 | grunt.log.writeln('File ' + destFilepath.cyan + ' created.'); 30 | }; 31 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/bs-glyphicons-data-generator.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Grunt task for Glyphicons data generation 3 | * https://getbootstrap.com/ 4 | * Copyright 2014-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | 12 | module.exports = function generateGlyphiconsData(grunt) { 13 | // Pass encoding, utf8, so `readFileSync` will return a string instead of a 14 | // buffer 15 | var glyphiconsFile = fs.readFileSync('less/glyphicons.less', 'utf8'); 16 | var glyphiconsLines = glyphiconsFile.split('\n'); 17 | 18 | // Use any line that starts with ".glyphicon-" and capture the class name 19 | var iconClassName = /^\.(glyphicon-[a-zA-Z0-9-]+)/; 20 | var glyphiconsData = '# This file is generated via Grunt task. **Do not edit directly.**\n' + 21 | '# See the \'build-glyphicons-data\' task in Gruntfile.js.\n\n'; 22 | var glyphiconsYml = 'docs/_data/glyphicons.yml'; 23 | for (var i = 0, len = glyphiconsLines.length; i < len; i++) { 24 | var match = glyphiconsLines[i].match(iconClassName); 25 | 26 | if (match !== null) { 27 | glyphiconsData += '- ' + match[1] + '\n'; 28 | } 29 | } 30 | 31 | // Create the `_data` directory if it doesn't already exist 32 | if (!fs.existsSync('docs/_data')) { 33 | fs.mkdirSync('docs/_data'); 34 | } 35 | 36 | try { 37 | fs.writeFileSync(glyphiconsYml, glyphiconsData); 38 | } catch (err) { 39 | grunt.fail.warn(err); 40 | } 41 | grunt.log.writeln('File ' + glyphiconsYml.cyan + ' created.'); 42 | }; 43 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/bs-raw-files-generator.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Grunt task for generating raw-files.min.js for the Customizer 3 | * https://getbootstrap.com/ 4 | * Copyright 2014-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | var btoa = require('btoa'); 12 | var glob = require('glob'); 13 | 14 | function getFiles(type) { 15 | var files = {}; 16 | var recursive = type === 'less'; 17 | var globExpr = recursive ? '/**/*' : '/*'; 18 | glob.sync(type + globExpr) 19 | .filter(function (path) { 20 | return type === 'fonts' ? true : new RegExp('\\.' + type + '$').test(path); 21 | }) 22 | .forEach(function (fullPath) { 23 | var relativePath = fullPath.replace(/^[^/]+\//, ''); 24 | files[relativePath] = type === 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'); 25 | }); 26 | return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'; 27 | } 28 | 29 | module.exports = function generateRawFilesJs(grunt, banner) { 30 | if (!banner) { 31 | banner = ''; 32 | } 33 | var dirs = ['js', 'less', 'fonts']; 34 | var files = banner + dirs.map(getFiles).reduce(function (combined, file) { 35 | return combined + file; 36 | }, ''); 37 | var rawFilesJs = 'docs/assets/js/raw-files.min.js'; 38 | try { 39 | fs.writeFileSync(rawFilesJs, files); 40 | } catch (err) { 41 | grunt.fail.warn(err); 42 | } 43 | grunt.log.writeln('File ' + rawFilesJs.cyan + ' created.'); 44 | }; 45 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/change-version.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | /* globals Set */ 5 | /*! 6 | * Script to update version number references in the project. 7 | * Copyright 2015-2019 Twitter, Inc. 8 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 9 | */ 10 | var fs = require('fs'); 11 | var path = require('path'); 12 | var sh = require('shelljs'); 13 | sh.config.fatal = true; 14 | var sed = sh.sed; 15 | 16 | // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 17 | RegExp.quote = function (string) { 18 | return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); 19 | }; 20 | RegExp.quoteReplacement = function (string) { 21 | return string.replace(/[$]/g, '$$'); 22 | }; 23 | 24 | var DRY_RUN = false; 25 | 26 | function walkAsync(directory, excludedDirectories, fileCallback, errback) { 27 | if (excludedDirectories.has(path.parse(directory).base)) { 28 | return; 29 | } 30 | fs.readdir(directory, function (err, names) { 31 | if (err) { 32 | errback(err); 33 | return; 34 | } 35 | names.forEach(function (name) { 36 | var filepath = path.join(directory, name); 37 | fs.lstat(filepath, function (err, stats) { 38 | if (err) { 39 | process.nextTick(errback, err); 40 | return; 41 | } 42 | if (stats.isSymbolicLink()) { 43 | return; 44 | } 45 | else if (stats.isDirectory()) { 46 | process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback); 47 | } 48 | else if (stats.isFile()) { 49 | process.nextTick(fileCallback, filepath); 50 | } 51 | }); 52 | }); 53 | }); 54 | } 55 | 56 | function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) { 57 | original = new RegExp(RegExp.quote(original), 'g'); 58 | replacement = RegExp.quoteReplacement(replacement); 59 | var updateFile = !DRY_RUN ? function (filepath) { 60 | if (allowedExtensions.has(path.parse(filepath).ext)) { 61 | sed('-i', original, replacement, filepath); 62 | } 63 | } : function (filepath) { 64 | if (allowedExtensions.has(path.parse(filepath).ext)) { 65 | console.log('FILE: ' + filepath); 66 | } 67 | else { 68 | console.log('EXCLUDED:' + filepath); 69 | } 70 | }; 71 | walkAsync(directory, excludedDirectories, updateFile, function (err) { 72 | console.error('ERROR while traversing directory!:'); 73 | console.error(err); 74 | process.exit(1); 75 | }); 76 | } 77 | 78 | function main(args) { 79 | if (args.length !== 2) { 80 | console.error('USAGE: change-version old_version new_version'); 81 | console.error('Got arguments:', args); 82 | process.exit(1); 83 | } 84 | var oldVersion = args[0]; 85 | var newVersion = args[1]; 86 | var EXCLUDED_DIRS = new Set([ 87 | '.git', 88 | 'node_modules', 89 | 'vendor' 90 | ]); 91 | var INCLUDED_EXTENSIONS = new Set([ 92 | // This extension whitelist is how we avoid modifying binary files 93 | '', 94 | '.css', 95 | '.html', 96 | '.js', 97 | '.json', 98 | '.less', 99 | '.md', 100 | '.nuspec', 101 | '.ps1', 102 | '.scss', 103 | '.txt', 104 | '.yml' 105 | ]); 106 | replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion); 107 | } 108 | 109 | main(process.argv.slice(2)); 110 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/configBridge.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "customizerJs": [ 4 | "../assets/js/vendor/autoprefixer.js", 5 | "../assets/js/vendor/less.min.js", 6 | "../assets/js/vendor/jszip.min.js", 7 | "../assets/js/vendor/uglify.min.js", 8 | "../assets/js/vendor/Blob.js", 9 | "../assets/js/vendor/FileSaver.js", 10 | "../assets/js/raw-files.min.js", 11 | "../assets/js/src/customizer.js" 12 | ], 13 | "docsJs": [ 14 | "../assets/js/vendor/requestAnimationFrame-polyfill.js", 15 | "../assets/js/vendor/base64.js", 16 | "../assets/js/vendor/holder.min.js", 17 | "../assets/js/vendor/clipboard.min.js", 18 | "../assets/js/vendor/anchor.min.js", 19 | "../assets/js/src/application.js", 20 | "../assets/js/src/search.js", 21 | "../assets/js/ie10-viewport-bug-workaround.js", 22 | "../assets/js/ie-emulation-modes-warning.js" 23 | ] 24 | }, 25 | "config": { 26 | "autoprefixer": { 27 | "browsers": [ 28 | "Android 2.3", 29 | "Android >= 4", 30 | "Chrome >= 20", 31 | "Firefox >= 24", 32 | "Explorer >= 8", 33 | "iOS >= 6", 34 | "Opera >= 12", 35 | "Safari >= 6" 36 | ], 37 | "cascade": false 38 | }, 39 | "jqueryCheck": [ 40 | "if (typeof jQuery === 'undefined') {", 41 | " throw new Error('Bootstrap\\'s JavaScript requires jQuery')", 42 | "}\n" 43 | ], 44 | "jqueryVersionCheck": [ 45 | "+function ($) {", 46 | " 'use strict';", 47 | " var version = $.fn.jquery.split(' ')[0].split('.')", 48 | " if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {", 49 | " throw new Error('Bootstrap\\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')", 50 | " }", 51 | "}(jQuery);\n\n" 52 | ] 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/generate-sri.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | /*! 6 | * Script to generate SRI hashes for use in our docs. 7 | * Remember to use the same vendor files as the CDN ones, 8 | * otherwise the hashes won't match! 9 | * 10 | * Copyright 2017-2019 The Bootstrap Authors 11 | * Copyright 2017-2019 Twitter, Inc. 12 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13 | */ 14 | 15 | var crypto = require('crypto'); 16 | var fs = require('fs'); 17 | var path = require('path'); 18 | var replace = require('replace-in-file'); 19 | 20 | var configFile = path.join(__dirname, '../_config.yml'); 21 | 22 | // Array of objects which holds the files to generate SRI hashes for. 23 | // `file` is the path from the root folder 24 | // `configPropertyName` is the _config.yml variable's name of the file 25 | var files = [ 26 | { 27 | file: 'dist/css/bootstrap.min.css', 28 | configPropertyName: 'css_hash' 29 | }, 30 | { 31 | file: 'dist/css/bootstrap-theme.min.css', 32 | configPropertyName: 'css_theme_hash' 33 | }, 34 | { 35 | file: 'dist/js/bootstrap.min.js', 36 | configPropertyName: 'js_hash' 37 | } 38 | ]; 39 | 40 | files.forEach(function (file) { 41 | fs.readFile(file.file, 'utf8', function (err, data) { 42 | if (err) { 43 | throw err; 44 | } 45 | 46 | var algo = 'sha384'; 47 | var hash = crypto.createHash(algo).update(data, 'utf8').digest('base64'); 48 | var integrity = algo + '-' + hash; 49 | 50 | console.log(file.configPropertyName + ': ' + integrity); 51 | 52 | try { 53 | replace.sync({ 54 | files: configFile, 55 | from: new RegExp('(\\s' + file.configPropertyName + ':\\s+"|\')(\\S+)("|\')'), 56 | to: '$1' + integrity + '$3' 57 | }); 58 | } catch (error) { 59 | console.error('Error occurred:', error); 60 | } 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/grunt/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var ip = require('ip'); 4 | var browserConfig = require('./browsers'); 5 | var browserStack = process.env.BROWSER === 'true'; 6 | 7 | module.exports = function (config) { 8 | var conf = { 9 | basePath: '../', 10 | frameworks: ['qunit'], 11 | plugins: ['karma-qunit'], 12 | // list of files / patterns to load in the browser 13 | files: [ 14 | 'js/tests/vendor/jquery.min.js', 15 | 'js/tooltip.js', 16 | 'js/!(tooltip).js', 17 | 'js/tests/unit/*.js' 18 | ], 19 | reporters: ['dots'], 20 | port: 9876, 21 | colors: true, 22 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 23 | logLevel: config.LOG_ERROR || config.LOG_WARN, 24 | autoWatch: false, 25 | singleRun: true, 26 | concurrency: Infinity, 27 | client: { 28 | qunit: { 29 | showUI: true 30 | } 31 | } 32 | }; 33 | 34 | if (browserStack) { 35 | conf.hostname = ip.address(); 36 | conf.browserStack = { 37 | username: process.env.BROWSER_STACK_USERNAME, 38 | accessKey: process.env.BROWSER_STACK_ACCESS_KEY, 39 | build: 'bootstrap-v3-' + new Date().toISOString(), 40 | project: 'Bootstrap v3', 41 | retryLimit: 1 42 | }; 43 | conf.plugins.push('karma-browserstack-launcher'); 44 | conf.customLaunchers = browserConfig.list; 45 | conf.browsers = browserConfig.keys; 46 | conf.reporters.push('BrowserStack'); 47 | } else { 48 | conf.frameworks.push('detectBrowsers'); 49 | conf.plugins.push( 50 | 'karma-chrome-launcher', 51 | 'karma-firefox-launcher', 52 | 'karma-detect-browsers' 53 | ); 54 | 55 | conf.detectBrowsers = { 56 | usePhantomJS: false, 57 | postDetection: function (availableBrowser) { 58 | if (typeof process.env.TRAVIS_JOB_ID !== 'undefined' || availableBrowser.includes('Chrome')) { 59 | return ['ChromeHeadless']; 60 | } 61 | 62 | if (availableBrowser.includes('Firefox')) { 63 | return ['FirefoxHeadless']; 64 | } 65 | 66 | throw new Error('Please install Firefox or Chrome'); 67 | } 68 | }; 69 | 70 | conf.customLaunchers = { 71 | FirefoxHeadless: { 72 | base: 'Firefox', 73 | flags: ['-headless'] 74 | } 75 | }; 76 | } 77 | 78 | config.set(conf); 79 | }; 80 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "disallowEmptyBlocks": true, 3 | "disallowKeywords": ["with"], 4 | "disallowMixedSpacesAndTabs": true, 5 | "disallowMultipleLineStrings": true, 6 | "disallowMultipleVarDecl": true, 7 | "disallowQuotedKeysInObjects": "allButReserved", 8 | "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], 9 | "disallowSpaceBeforeBinaryOperators": [","], 10 | "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], 11 | "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, 12 | "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, 13 | "disallowSpacesInsideArrayBrackets": true, 14 | "disallowSpacesInsideParentheses": true, 15 | "disallowTrailingComma": true, 16 | "disallowTrailingWhitespace": true, 17 | "requireCamelCaseOrUpperCaseIdentifiers": true, 18 | "requireCapitalizedConstructors": true, 19 | "requireCommaBeforeLineBreak": true, 20 | "requireDollarBeforejQueryAssignment": true, 21 | "requireDotNotation": true, 22 | "requireLineFeedAtFileEnd": true, 23 | "requirePaddingNewLinesAfterUseStrict": true, 24 | "requirePaddingNewLinesBeforeExport": true, 25 | "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], 26 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], 27 | "requireSpaceAfterLineComment": true, 28 | "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], 29 | "requireSpaceBetweenArguments": true, 30 | "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true, "beforeOpeningRoundBrace": true }, 31 | "requireSpacesInConditionalExpression": true, 32 | "requireSpacesInForStatement": true, 33 | "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, 34 | "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, 35 | "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, 36 | "requireSpacesInsideObjectBrackets": "allButNested", 37 | "validateAlignedFunctionParameters": true, 38 | "validateIndentation": 2, 39 | "validateLineBreaks": "LF", 40 | "validateNewlineAfterArrayElements": true, 41 | "validateQuoteMarks": "'" 42 | } 43 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi" : true, 3 | "browser" : true, 4 | "eqeqeq" : false, 5 | "eqnull" : true, 6 | "es3" : true, 7 | "expr" : true, 8 | "jquery" : true, 9 | "latedef" : true, 10 | "laxbreak" : true, 11 | "nonbsp" : true, 12 | "strict" : true, 13 | "undef" : true, 14 | "unused" : true 15 | } 16 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/alert.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: alert.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#alerts 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // ALERT CLASS DEFINITION 14 | // ====================== 15 | 16 | var dismiss = '[data-dismiss="alert"]' 17 | var Alert = function (el) { 18 | $(el).on('click', dismiss, this.close) 19 | } 20 | 21 | Alert.VERSION = '3.4.1' 22 | 23 | Alert.TRANSITION_DURATION = 150 24 | 25 | Alert.prototype.close = function (e) { 26 | var $this = $(this) 27 | var selector = $this.attr('data-target') 28 | 29 | if (!selector) { 30 | selector = $this.attr('href') 31 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 32 | } 33 | 34 | selector = selector === '#' ? [] : selector 35 | var $parent = $(document).find(selector) 36 | 37 | if (e) e.preventDefault() 38 | 39 | if (!$parent.length) { 40 | $parent = $this.closest('.alert') 41 | } 42 | 43 | $parent.trigger(e = $.Event('close.bs.alert')) 44 | 45 | if (e.isDefaultPrevented()) return 46 | 47 | $parent.removeClass('in') 48 | 49 | function removeElement() { 50 | // detach from parent, fire event then clean up data 51 | $parent.detach().trigger('closed.bs.alert').remove() 52 | } 53 | 54 | $.support.transition && $parent.hasClass('fade') ? 55 | $parent 56 | .one('bsTransitionEnd', removeElement) 57 | .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 58 | removeElement() 59 | } 60 | 61 | 62 | // ALERT PLUGIN DEFINITION 63 | // ======================= 64 | 65 | function Plugin(option) { 66 | return this.each(function () { 67 | var $this = $(this) 68 | var data = $this.data('bs.alert') 69 | 70 | if (!data) $this.data('bs.alert', (data = new Alert(this))) 71 | if (typeof option == 'string') data[option].call($this) 72 | }) 73 | } 74 | 75 | var old = $.fn.alert 76 | 77 | $.fn.alert = Plugin 78 | $.fn.alert.Constructor = Alert 79 | 80 | 81 | // ALERT NO CONFLICT 82 | // ================= 83 | 84 | $.fn.alert.noConflict = function () { 85 | $.fn.alert = old 86 | return this 87 | } 88 | 89 | 90 | // ALERT DATA-API 91 | // ============== 92 | 93 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 94 | 95 | }(jQuery); 96 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/button.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: button.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#buttons 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // BUTTON PUBLIC CLASS DEFINITION 14 | // ============================== 15 | 16 | var Button = function (element, options) { 17 | this.$element = $(element) 18 | this.options = $.extend({}, Button.DEFAULTS, options) 19 | this.isLoading = false 20 | } 21 | 22 | Button.VERSION = '3.4.1' 23 | 24 | Button.DEFAULTS = { 25 | loadingText: 'loading...' 26 | } 27 | 28 | Button.prototype.setState = function (state) { 29 | var d = 'disabled' 30 | var $el = this.$element 31 | var val = $el.is('input') ? 'val' : 'html' 32 | var data = $el.data() 33 | 34 | state += 'Text' 35 | 36 | if (data.resetText == null) $el.data('resetText', $el[val]()) 37 | 38 | // push to event loop to allow forms to submit 39 | setTimeout($.proxy(function () { 40 | $el[val](data[state] == null ? this.options[state] : data[state]) 41 | 42 | if (state == 'loadingText') { 43 | this.isLoading = true 44 | $el.addClass(d).attr(d, d).prop(d, true) 45 | } else if (this.isLoading) { 46 | this.isLoading = false 47 | $el.removeClass(d).removeAttr(d).prop(d, false) 48 | } 49 | }, this), 0) 50 | } 51 | 52 | Button.prototype.toggle = function () { 53 | var changed = true 54 | var $parent = this.$element.closest('[data-toggle="buttons"]') 55 | 56 | if ($parent.length) { 57 | var $input = this.$element.find('input') 58 | if ($input.prop('type') == 'radio') { 59 | if ($input.prop('checked')) changed = false 60 | $parent.find('.active').removeClass('active') 61 | this.$element.addClass('active') 62 | } else if ($input.prop('type') == 'checkbox') { 63 | if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false 64 | this.$element.toggleClass('active') 65 | } 66 | $input.prop('checked', this.$element.hasClass('active')) 67 | if (changed) $input.trigger('change') 68 | } else { 69 | this.$element.attr('aria-pressed', !this.$element.hasClass('active')) 70 | this.$element.toggleClass('active') 71 | } 72 | } 73 | 74 | 75 | // BUTTON PLUGIN DEFINITION 76 | // ======================== 77 | 78 | function Plugin(option) { 79 | return this.each(function () { 80 | var $this = $(this) 81 | var data = $this.data('bs.button') 82 | var options = typeof option == 'object' && option 83 | 84 | if (!data) $this.data('bs.button', (data = new Button(this, options))) 85 | 86 | if (option == 'toggle') data.toggle() 87 | else if (option) data.setState(option) 88 | }) 89 | } 90 | 91 | var old = $.fn.button 92 | 93 | $.fn.button = Plugin 94 | $.fn.button.Constructor = Button 95 | 96 | 97 | // BUTTON NO CONFLICT 98 | // ================== 99 | 100 | $.fn.button.noConflict = function () { 101 | $.fn.button = old 102 | return this 103 | } 104 | 105 | 106 | // BUTTON DATA-API 107 | // =============== 108 | 109 | $(document) 110 | .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { 111 | var $btn = $(e.target).closest('.btn') 112 | Plugin.call($btn, 'toggle') 113 | if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { 114 | // Prevent double click on radios, and the double selections (so cancellation) on checkboxes 115 | e.preventDefault() 116 | // The target component still receive the focus 117 | if ($btn.is('input,button')) $btn.trigger('focus') 118 | else $btn.find('input:visible,button:visible').first().trigger('focus') 119 | } 120 | }) 121 | .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { 122 | $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) 123 | }) 124 | 125 | }(jQuery); 126 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/popover.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: popover.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#popovers 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // POPOVER PUBLIC CLASS DEFINITION 14 | // =============================== 15 | 16 | var Popover = function (element, options) { 17 | this.init('popover', element, options) 18 | } 19 | 20 | if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 21 | 22 | Popover.VERSION = '3.4.1' 23 | 24 | Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 25 | placement: 'right', 26 | trigger: 'click', 27 | content: '', 28 | template: '' 29 | }) 30 | 31 | 32 | // NOTE: POPOVER EXTENDS tooltip.js 33 | // ================================ 34 | 35 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 36 | 37 | Popover.prototype.constructor = Popover 38 | 39 | Popover.prototype.getDefaults = function () { 40 | return Popover.DEFAULTS 41 | } 42 | 43 | Popover.prototype.setContent = function () { 44 | var $tip = this.tip() 45 | var title = this.getTitle() 46 | var content = this.getContent() 47 | 48 | if (this.options.html) { 49 | var typeContent = typeof content 50 | 51 | if (this.options.sanitize) { 52 | title = this.sanitizeHtml(title) 53 | 54 | if (typeContent === 'string') { 55 | content = this.sanitizeHtml(content) 56 | } 57 | } 58 | 59 | $tip.find('.popover-title').html(title) 60 | $tip.find('.popover-content').children().detach().end()[ 61 | typeContent === 'string' ? 'html' : 'append' 62 | ](content) 63 | } else { 64 | $tip.find('.popover-title').text(title) 65 | $tip.find('.popover-content').children().detach().end().text(content) 66 | } 67 | 68 | $tip.removeClass('fade top bottom left right in') 69 | 70 | // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 71 | // this manually by checking the contents. 72 | if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 73 | } 74 | 75 | Popover.prototype.hasContent = function () { 76 | return this.getTitle() || this.getContent() 77 | } 78 | 79 | Popover.prototype.getContent = function () { 80 | var $e = this.$element 81 | var o = this.options 82 | 83 | return $e.attr('data-content') 84 | || (typeof o.content == 'function' ? 85 | o.content.call($e[0]) : 86 | o.content) 87 | } 88 | 89 | Popover.prototype.arrow = function () { 90 | return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 91 | } 92 | 93 | 94 | // POPOVER PLUGIN DEFINITION 95 | // ========================= 96 | 97 | function Plugin(option) { 98 | return this.each(function () { 99 | var $this = $(this) 100 | var data = $this.data('bs.popover') 101 | var options = typeof option == 'object' && option 102 | 103 | if (!data && /destroy|hide/.test(option)) return 104 | if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 105 | if (typeof option == 'string') data[option]() 106 | }) 107 | } 108 | 109 | var old = $.fn.popover 110 | 111 | $.fn.popover = Plugin 112 | $.fn.popover.Constructor = Popover 113 | 114 | 115 | // POPOVER NO CONFLICT 116 | // =================== 117 | 118 | $.fn.popover.noConflict = function () { 119 | $.fn.popover = old 120 | return this 121 | } 122 | 123 | }(jQuery); 124 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/tab.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: tab.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#tabs 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // TAB CLASS DEFINITION 14 | // ==================== 15 | 16 | var Tab = function (element) { 17 | // jscs:disable requireDollarBeforejQueryAssignment 18 | this.element = $(element) 19 | // jscs:enable requireDollarBeforejQueryAssignment 20 | } 21 | 22 | Tab.VERSION = '3.4.1' 23 | 24 | Tab.TRANSITION_DURATION = 150 25 | 26 | Tab.prototype.show = function () { 27 | var $this = this.element 28 | var $ul = $this.closest('ul:not(.dropdown-menu)') 29 | var selector = $this.data('target') 30 | 31 | if (!selector) { 32 | selector = $this.attr('href') 33 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 34 | } 35 | 36 | if ($this.parent('li').hasClass('active')) return 37 | 38 | var $previous = $ul.find('.active:last a') 39 | var hideEvent = $.Event('hide.bs.tab', { 40 | relatedTarget: $this[0] 41 | }) 42 | var showEvent = $.Event('show.bs.tab', { 43 | relatedTarget: $previous[0] 44 | }) 45 | 46 | $previous.trigger(hideEvent) 47 | $this.trigger(showEvent) 48 | 49 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 50 | 51 | var $target = $(document).find(selector) 52 | 53 | this.activate($this.closest('li'), $ul) 54 | this.activate($target, $target.parent(), function () { 55 | $previous.trigger({ 56 | type: 'hidden.bs.tab', 57 | relatedTarget: $this[0] 58 | }) 59 | $this.trigger({ 60 | type: 'shown.bs.tab', 61 | relatedTarget: $previous[0] 62 | }) 63 | }) 64 | } 65 | 66 | Tab.prototype.activate = function (element, container, callback) { 67 | var $active = container.find('> .active') 68 | var transition = callback 69 | && $.support.transition 70 | && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 71 | 72 | function next() { 73 | $active 74 | .removeClass('active') 75 | .find('> .dropdown-menu > .active') 76 | .removeClass('active') 77 | .end() 78 | .find('[data-toggle="tab"]') 79 | .attr('aria-expanded', false) 80 | 81 | element 82 | .addClass('active') 83 | .find('[data-toggle="tab"]') 84 | .attr('aria-expanded', true) 85 | 86 | if (transition) { 87 | element[0].offsetWidth // reflow for transition 88 | element.addClass('in') 89 | } else { 90 | element.removeClass('fade') 91 | } 92 | 93 | if (element.parent('.dropdown-menu').length) { 94 | element 95 | .closest('li.dropdown') 96 | .addClass('active') 97 | .end() 98 | .find('[data-toggle="tab"]') 99 | .attr('aria-expanded', true) 100 | } 101 | 102 | callback && callback() 103 | } 104 | 105 | $active.length && transition ? 106 | $active 107 | .one('bsTransitionEnd', next) 108 | .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 109 | next() 110 | 111 | $active.removeClass('in') 112 | } 113 | 114 | 115 | // TAB PLUGIN DEFINITION 116 | // ===================== 117 | 118 | function Plugin(option) { 119 | return this.each(function () { 120 | var $this = $(this) 121 | var data = $this.data('bs.tab') 122 | 123 | if (!data) $this.data('bs.tab', (data = new Tab(this))) 124 | if (typeof option == 'string') data[option]() 125 | }) 126 | } 127 | 128 | var old = $.fn.tab 129 | 130 | $.fn.tab = Plugin 131 | $.fn.tab.Constructor = Tab 132 | 133 | 134 | // TAB NO CONFLICT 135 | // =============== 136 | 137 | $.fn.tab.noConflict = function () { 138 | $.fn.tab = old 139 | return this 140 | } 141 | 142 | 143 | // TAB DATA-API 144 | // ============ 145 | 146 | var clickHandler = function (e) { 147 | e.preventDefault() 148 | Plugin.call($(this), 'show') 149 | } 150 | 151 | $(document) 152 | .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 153 | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 154 | 155 | }(jQuery); 156 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/js/transition.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: transition.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#transitions 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) 14 | // ============================================================ 15 | 16 | function transitionEnd() { 17 | var el = document.createElement('bootstrap') 18 | 19 | var transEndEventNames = { 20 | WebkitTransition : 'webkitTransitionEnd', 21 | MozTransition : 'transitionend', 22 | OTransition : 'oTransitionEnd otransitionend', 23 | transition : 'transitionend' 24 | } 25 | 26 | for (var name in transEndEventNames) { 27 | if (el.style[name] !== undefined) { 28 | return { end: transEndEventNames[name] } 29 | } 30 | } 31 | 32 | return false // explicit for ie8 ( ._.) 33 | } 34 | 35 | // https://blog.alexmaccaw.com/css-transitions 36 | $.fn.emulateTransitionEnd = function (duration) { 37 | var called = false 38 | var $el = this 39 | $(this).one('bsTransitionEnd', function () { called = true }) 40 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 41 | setTimeout(callback, duration) 42 | return this 43 | } 44 | 45 | $(function () { 46 | $.support.transition = transitionEnd() 47 | 48 | if (!$.support.transition) return 49 | 50 | $.event.special.bsTransitionEnd = { 51 | bindType: $.support.transition.end, 52 | delegateType: $.support.transition.end, 53 | handle: function (e) { 54 | if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 55 | } 56 | } 57 | }) 58 | 59 | }(jQuery); 60 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: @alert-padding; 11 | margin-bottom: @line-height-computed; 12 | border: 1px solid transparent; 13 | border-radius: @alert-border-radius; 14 | 15 | // Headings for larger alerts 16 | h4 { 17 | margin-top: 0; 18 | color: inherit; // Specified for the h4 to prevent conflicts of changing @headings-color 19 | } 20 | 21 | // Provide class for links that match alerts 22 | .alert-link { 23 | font-weight: @alert-link-font-weight; 24 | } 25 | 26 | // Improve alignment and spacing of inner content 27 | > p, 28 | > ul { 29 | margin-bottom: 0; 30 | } 31 | 32 | > p + p { 33 | margin-top: 5px; 34 | } 35 | } 36 | 37 | // Dismissible alerts 38 | // 39 | // Expand the right padding and account for the close button's positioning. 40 | 41 | // The misspelled .alert-dismissable was deprecated in 3.2.0. 42 | .alert-dismissable, 43 | .alert-dismissible { 44 | padding-right: (@alert-padding + 20); 45 | 46 | // Adjust close link position 47 | .close { 48 | position: relative; 49 | top: -2px; 50 | right: -21px; 51 | color: inherit; 52 | } 53 | } 54 | 55 | // Alternate styles 56 | // 57 | // Generate contextual modifier classes for colorizing the alert. 58 | 59 | .alert-success { 60 | .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text); 61 | } 62 | 63 | .alert-info { 64 | .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text); 65 | } 66 | 67 | .alert-warning { 68 | .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text); 69 | } 70 | 71 | .alert-danger { 72 | .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text); 73 | } 74 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .badge { 8 | display: inline-block; 9 | min-width: 10px; 10 | padding: 3px 7px; 11 | font-size: @font-size-small; 12 | font-weight: @badge-font-weight; 13 | line-height: @badge-line-height; 14 | color: @badge-color; 15 | text-align: center; 16 | white-space: nowrap; 17 | vertical-align: middle; 18 | background-color: @badge-bg; 19 | border-radius: @badge-border-radius; 20 | 21 | // Empty badges collapse automatically (not available in IE8) 22 | &:empty { 23 | display: none; 24 | } 25 | 26 | // Quick fix for badges in buttons 27 | .btn & { 28 | position: relative; 29 | top: -1px; 30 | } 31 | 32 | .btn-xs &, 33 | .btn-group-xs > .btn & { 34 | top: 0; 35 | padding: 1px 5px; 36 | } 37 | 38 | // Hover state, but only for links 39 | a& { 40 | &:hover, 41 | &:focus { 42 | color: @badge-link-hover-color; 43 | text-decoration: none; 44 | cursor: pointer; 45 | } 46 | } 47 | 48 | // Account for badges in navs 49 | .list-group-item.active > &, 50 | .nav-pills > .active > a > & { 51 | color: @badge-active-color; 52 | background-color: @badge-active-bg; 53 | } 54 | 55 | .list-group-item > & { 56 | float: right; 57 | } 58 | 59 | .list-group-item > & + & { 60 | margin-right: 5px; 61 | } 62 | 63 | .nav-pills > li > a > & { 64 | margin-left: 3px; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/bootstrap.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.4.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | 7 | // Core variables and mixins 8 | @import "variables.less"; 9 | @import "mixins.less"; 10 | 11 | // Reset and dependencies 12 | @import "normalize.less"; 13 | @import "print.less"; 14 | @import "glyphicons.less"; 15 | 16 | // Core CSS 17 | @import "scaffolding.less"; 18 | @import "type.less"; 19 | @import "code.less"; 20 | @import "grid.less"; 21 | @import "tables.less"; 22 | @import "forms.less"; 23 | @import "buttons.less"; 24 | 25 | // Components 26 | @import "component-animations.less"; 27 | @import "dropdowns.less"; 28 | @import "button-groups.less"; 29 | @import "input-groups.less"; 30 | @import "navs.less"; 31 | @import "navbar.less"; 32 | @import "breadcrumbs.less"; 33 | @import "pagination.less"; 34 | @import "pager.less"; 35 | @import "labels.less"; 36 | @import "badges.less"; 37 | @import "jumbotron.less"; 38 | @import "thumbnails.less"; 39 | @import "alerts.less"; 40 | @import "progress-bars.less"; 41 | @import "media.less"; 42 | @import "list-group.less"; 43 | @import "panels.less"; 44 | @import "responsive-embed.less"; 45 | @import "wells.less"; 46 | @import "close.less"; 47 | 48 | // Components w/ JavaScript 49 | @import "modals.less"; 50 | @import "tooltip.less"; 51 | @import "popovers.less"; 52 | @import "carousel.less"; 53 | 54 | // Utility classes 55 | @import "utilities.less"; 56 | @import "responsive-utilities.less"; 57 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal; 8 | margin-bottom: @line-height-computed; 9 | list-style: none; 10 | background-color: @breadcrumb-bg; 11 | border-radius: @border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | padding: 0 5px; 18 | color: @breadcrumb-color; 19 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 20 | } 21 | } 22 | 23 | > .active { 24 | color: @breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/buttons.less: -------------------------------------------------------------------------------- 1 | // stylelint-disable selector-no-qualifying-type 2 | 3 | // 4 | // Buttons 5 | // -------------------------------------------------- 6 | 7 | 8 | // Base styles 9 | // -------------------------------------------------- 10 | 11 | .btn { 12 | display: inline-block; 13 | margin-bottom: 0; // For input.btn 14 | font-weight: @btn-font-weight; 15 | text-align: center; 16 | white-space: nowrap; 17 | vertical-align: middle; 18 | touch-action: manipulation; 19 | cursor: pointer; 20 | background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 21 | border: 1px solid transparent; 22 | .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @btn-border-radius-base); 23 | .user-select(none); 24 | 25 | &, 26 | &:active, 27 | &.active { 28 | &:focus, 29 | &.focus { 30 | .tab-focus(); 31 | } 32 | } 33 | 34 | &:hover, 35 | &:focus, 36 | &.focus { 37 | color: @btn-default-color; 38 | text-decoration: none; 39 | } 40 | 41 | &:active, 42 | &.active { 43 | background-image: none; 44 | outline: 0; 45 | .box-shadow(inset 0 3px 5px rgba(0, 0, 0, .125)); 46 | } 47 | 48 | &.disabled, 49 | &[disabled], 50 | fieldset[disabled] & { 51 | cursor: @cursor-disabled; 52 | .opacity(.65); 53 | .box-shadow(none); 54 | } 55 | 56 | a& { 57 | &.disabled, 58 | fieldset[disabled] & { 59 | pointer-events: none; // Future-proof disabling of clicks on `` elements 60 | } 61 | } 62 | } 63 | 64 | 65 | // Alternate buttons 66 | // -------------------------------------------------- 67 | 68 | .btn-default { 69 | .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border); 70 | } 71 | .btn-primary { 72 | .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border); 73 | } 74 | // Success appears as green 75 | .btn-success { 76 | .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border); 77 | } 78 | // Info appears as blue-green 79 | .btn-info { 80 | .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border); 81 | } 82 | // Warning appears as orange 83 | .btn-warning { 84 | .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border); 85 | } 86 | // Danger and error appear as red 87 | .btn-danger { 88 | .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border); 89 | } 90 | 91 | 92 | // Link buttons 93 | // ------------------------- 94 | 95 | // Make a button look and behave like a link 96 | .btn-link { 97 | font-weight: 400; 98 | color: @link-color; 99 | border-radius: 0; 100 | 101 | &, 102 | &:active, 103 | &.active, 104 | &[disabled], 105 | fieldset[disabled] & { 106 | background-color: transparent; 107 | .box-shadow(none); 108 | } 109 | &, 110 | &:hover, 111 | &:focus, 112 | &:active { 113 | border-color: transparent; 114 | } 115 | &:hover, 116 | &:focus { 117 | color: @link-hover-color; 118 | text-decoration: @link-hover-decoration; 119 | background-color: transparent; 120 | } 121 | &[disabled], 122 | fieldset[disabled] & { 123 | &:hover, 124 | &:focus { 125 | color: @btn-link-disabled-color; 126 | text-decoration: none; 127 | } 128 | } 129 | } 130 | 131 | 132 | // Button Sizes 133 | // -------------------------------------------------- 134 | 135 | .btn-lg { 136 | // line-height: ensure even-numbered height of button next to large input 137 | .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @btn-border-radius-large); 138 | } 139 | .btn-sm { 140 | // line-height: ensure proper height of button next to small input 141 | .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @btn-border-radius-small); 142 | } 143 | .btn-xs { 144 | .button-size(@padding-xs-vertical; @padding-xs-horizontal; @font-size-small; @line-height-small; @btn-border-radius-small); 145 | } 146 | 147 | 148 | // Block button 149 | // -------------------------------------------------- 150 | 151 | .btn-block { 152 | display: block; 153 | width: 100%; 154 | } 155 | 156 | // Vertically space out multiple block buttons 157 | .btn-block + .btn-block { 158 | margin-top: 5px; 159 | } 160 | 161 | // Specificity overrides 162 | input[type="submit"], 163 | input[type="reset"], 164 | input[type="button"] { 165 | &.btn-block { 166 | width: 100%; 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/close.less: -------------------------------------------------------------------------------- 1 | // stylelint-disable property-no-vendor-prefix 2 | 3 | // 4 | // Close icons 5 | // -------------------------------------------------- 6 | 7 | 8 | .close { 9 | float: right; 10 | font-size: (@font-size-base * 1.5); 11 | font-weight: @close-font-weight; 12 | line-height: 1; 13 | color: @close-color; 14 | text-shadow: @close-text-shadow; 15 | .opacity(.2); 16 | 17 | &:hover, 18 | &:focus { 19 | color: @close-color; 20 | text-decoration: none; 21 | cursor: pointer; 22 | .opacity(.5); 23 | } 24 | 25 | // Additional properties for button version 26 | // iOS requires the button element instead of an anchor tag. 27 | // If you want the anchor version, it requires `href="#"`. 28 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 29 | button& { 30 | padding: 0; 31 | cursor: pointer; 32 | background: transparent; 33 | border: 0; 34 | -webkit-appearance: none; 35 | appearance: none; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/code.less: -------------------------------------------------------------------------------- 1 | // 2 | // Code (inline and block) 3 | // -------------------------------------------------- 4 | 5 | 6 | // Inline and block code styles 7 | code, 8 | kbd, 9 | pre, 10 | samp { 11 | font-family: @font-family-monospace; 12 | } 13 | 14 | // Inline code 15 | code { 16 | padding: 2px 4px; 17 | font-size: 90%; 18 | color: @code-color; 19 | background-color: @code-bg; 20 | border-radius: @border-radius-base; 21 | } 22 | 23 | // User input typically entered via keyboard 24 | kbd { 25 | padding: 2px 4px; 26 | font-size: 90%; 27 | color: @kbd-color; 28 | background-color: @kbd-bg; 29 | border-radius: @border-radius-small; 30 | box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); 31 | 32 | kbd { 33 | padding: 0; 34 | font-size: 100%; 35 | font-weight: 700; 36 | box-shadow: none; 37 | } 38 | } 39 | 40 | // Blocks of code 41 | pre { 42 | display: block; 43 | padding: ((@line-height-computed - 1) / 2); 44 | margin: 0 0 (@line-height-computed / 2); 45 | font-size: (@font-size-base - 1); // 14px to 13px 46 | line-height: @line-height-base; 47 | color: @pre-color; 48 | word-break: break-all; 49 | word-wrap: break-word; 50 | background-color: @pre-bg; 51 | border: 1px solid @pre-border-color; 52 | border-radius: @border-radius-base; 53 | 54 | // Account for some code outputs that place code tags in pre tags 55 | code { 56 | padding: 0; 57 | font-size: inherit; 58 | color: inherit; 59 | white-space: pre-wrap; 60 | background-color: transparent; 61 | border-radius: 0; 62 | } 63 | } 64 | 65 | // Enable scrollable blocks of code 66 | .pre-scrollable { 67 | max-height: @pre-scrollable-max-height; 68 | overflow-y: scroll; 69 | } 70 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/component-animations.less: -------------------------------------------------------------------------------- 1 | // stylelint-disable selector-no-qualifying-type 2 | 3 | // 4 | // Component animations 5 | // -------------------------------------------------- 6 | 7 | // Heads up! 8 | // 9 | // We don't use the `.opacity()` mixin here since it causes a bug with text 10 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 11 | 12 | .fade { 13 | opacity: 0; 14 | .transition(opacity .15s linear); 15 | 16 | &.in { 17 | opacity: 1; 18 | } 19 | } 20 | 21 | .collapse { 22 | display: none; 23 | 24 | &.in { display: block; } 25 | tr&.in { display: table-row; } 26 | tbody&.in { display: table-row-group; } 27 | } 28 | 29 | .collapsing { 30 | position: relative; 31 | height: 0; 32 | overflow: hidden; 33 | .transition-property(~"height, visibility"); 34 | .transition-duration(.35s); 35 | .transition-timing-function(ease); 36 | } 37 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container widths 7 | // 8 | // Set the container width, and override it for fixed navbars in media queries. 9 | 10 | .container { 11 | .container-fixed(); 12 | 13 | @media (min-width: @screen-sm-min) { 14 | width: @container-sm; 15 | } 16 | @media (min-width: @screen-md-min) { 17 | width: @container-md; 18 | } 19 | @media (min-width: @screen-lg-min) { 20 | width: @container-lg; 21 | } 22 | } 23 | 24 | 25 | // Fluid container 26 | // 27 | // Utilizes the mixin meant for fixed width containers, but without any defined 28 | // width for fluid, full width layouts. 29 | 30 | .container-fluid { 31 | .container-fixed(); 32 | } 33 | 34 | 35 | // Row 36 | // 37 | // Rows contain and clear the floats of your columns. 38 | 39 | .row { 40 | .make-row(); 41 | } 42 | 43 | .row-no-gutters { 44 | margin-right: 0; 45 | margin-left: 0; 46 | 47 | [class*="col-"] { 48 | padding-right: 0; 49 | padding-left: 0; 50 | } 51 | } 52 | 53 | 54 | // Columns 55 | // 56 | // Common styles for small and large grid columns 57 | 58 | .make-grid-columns(); 59 | 60 | 61 | // Extra small grid 62 | // 63 | // Columns, offsets, pushes, and pulls for extra small devices like 64 | // smartphones. 65 | 66 | .make-grid(xs); 67 | 68 | 69 | // Small grid 70 | // 71 | // Columns, offsets, pushes, and pulls for the small device range, from phones 72 | // to tablets. 73 | 74 | @media (min-width: @screen-sm-min) { 75 | .make-grid(sm); 76 | } 77 | 78 | 79 | // Medium grid 80 | // 81 | // Columns, offsets, pushes, and pulls for the desktop device range. 82 | 83 | @media (min-width: @screen-md-min) { 84 | .make-grid(md); 85 | } 86 | 87 | 88 | // Large grid 89 | // 90 | // Columns, offsets, pushes, and pulls for the large desktop device range. 91 | 92 | @media (min-width: @screen-lg-min) { 93 | .make-grid(lg); 94 | } 95 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/jumbotron.less: -------------------------------------------------------------------------------- 1 | // 2 | // Jumbotron 3 | // -------------------------------------------------- 4 | 5 | 6 | .jumbotron { 7 | padding-top: @jumbotron-padding; 8 | padding-bottom: @jumbotron-padding; 9 | margin-bottom: @jumbotron-padding; 10 | color: @jumbotron-color; 11 | background-color: @jumbotron-bg; 12 | 13 | h1, 14 | .h1 { 15 | color: @jumbotron-heading-color; 16 | } 17 | 18 | p { 19 | margin-bottom: (@jumbotron-padding / 2); 20 | font-size: @jumbotron-font-size; 21 | font-weight: 200; 22 | } 23 | 24 | > hr { 25 | border-top-color: darken(@jumbotron-bg, 10%); 26 | } 27 | 28 | .container &, 29 | .container-fluid & { 30 | padding-right: (@grid-gutter-width / 2); 31 | padding-left: (@grid-gutter-width / 2); 32 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container 33 | } 34 | 35 | .container { 36 | max-width: 100%; 37 | } 38 | 39 | @media screen and (min-width: @screen-sm-min) { 40 | padding-top: (@jumbotron-padding * 1.6); 41 | padding-bottom: (@jumbotron-padding * 1.6); 42 | 43 | .container &, 44 | .container-fluid & { 45 | padding-right: (@jumbotron-padding * 2); 46 | padding-left: (@jumbotron-padding * 2); 47 | } 48 | 49 | h1, 50 | .h1 { 51 | font-size: @jumbotron-heading-font-size; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/labels.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels 3 | // -------------------------------------------------- 4 | 5 | .label { 6 | display: inline; 7 | padding: .2em .6em .3em; 8 | font-size: 75%; 9 | font-weight: 700; 10 | line-height: 1; 11 | color: @label-color; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: baseline; 15 | border-radius: .25em; 16 | 17 | // Add hover effects, but only for links 18 | a& { 19 | &:hover, 20 | &:focus { 21 | color: @label-link-hover-color; 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | } 26 | 27 | // Empty labels collapse automatically (not available in IE8) 28 | &:empty { 29 | display: none; 30 | } 31 | 32 | // Quick fix for labels in buttons 33 | .btn & { 34 | position: relative; 35 | top: -1px; 36 | } 37 | } 38 | 39 | // Colors 40 | // Contextual variations (linked labels get darker on :hover) 41 | 42 | .label-default { 43 | .label-variant(@label-default-bg); 44 | } 45 | 46 | .label-primary { 47 | .label-variant(@label-primary-bg); 48 | } 49 | 50 | .label-success { 51 | .label-variant(@label-success-bg); 52 | } 53 | 54 | .label-info { 55 | .label-variant(@label-info-bg); 56 | } 57 | 58 | .label-warning { 59 | .label-variant(@label-warning-bg); 60 | } 61 | 62 | .label-danger { 63 | .label-variant(@label-danger-bg); 64 | } 65 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/list-group.less: -------------------------------------------------------------------------------- 1 | // stylelint-disable selector-no-qualifying-type 2 | 3 | // 4 | // List groups 5 | // -------------------------------------------------- 6 | 7 | 8 | // Base class 9 | // 10 | // Easily usable on
    ,
      , or
      . 11 | 12 | .list-group { 13 | // No need to set list-style: none; since .list-group-item is block level 14 | padding-left: 0; // reset padding because ul and ol 15 | margin-bottom: 20px; 16 | } 17 | 18 | 19 | // Individual list items 20 | // 21 | // Use on `li`s or `div`s within the `.list-group` parent. 22 | 23 | .list-group-item { 24 | position: relative; 25 | display: block; 26 | padding: 10px 15px; 27 | // Place the border on the list items and negative margin up for better styling 28 | margin-bottom: -1px; 29 | background-color: @list-group-bg; 30 | border: 1px solid @list-group-border; 31 | 32 | // Round the first and last items 33 | &:first-child { 34 | .border-top-radius(@list-group-border-radius); 35 | } 36 | &:last-child { 37 | margin-bottom: 0; 38 | .border-bottom-radius(@list-group-border-radius); 39 | } 40 | 41 | // Disabled state 42 | &.disabled, 43 | &.disabled:hover, 44 | &.disabled:focus { 45 | color: @list-group-disabled-color; 46 | cursor: @cursor-disabled; 47 | background-color: @list-group-disabled-bg; 48 | 49 | // Force color to inherit for custom content 50 | .list-group-item-heading { 51 | color: inherit; 52 | } 53 | .list-group-item-text { 54 | color: @list-group-disabled-text-color; 55 | } 56 | } 57 | 58 | // Active class on item itself, not parent 59 | &.active, 60 | &.active:hover, 61 | &.active:focus { 62 | z-index: 2; // Place active items above their siblings for proper border styling 63 | color: @list-group-active-color; 64 | background-color: @list-group-active-bg; 65 | border-color: @list-group-active-border; 66 | 67 | // Force color to inherit for custom content 68 | .list-group-item-heading, 69 | .list-group-item-heading > small, 70 | .list-group-item-heading > .small { 71 | color: inherit; 72 | } 73 | .list-group-item-text { 74 | color: @list-group-active-text-color; 75 | } 76 | } 77 | } 78 | 79 | 80 | // Interactive list items 81 | // 82 | // Use anchor or button elements instead of `li`s or `div`s to create interactive items. 83 | // Includes an extra `.active` modifier class for showing selected items. 84 | 85 | a.list-group-item, 86 | button.list-group-item { 87 | color: @list-group-link-color; 88 | 89 | .list-group-item-heading { 90 | color: @list-group-link-heading-color; 91 | } 92 | 93 | // Hover state 94 | &:hover, 95 | &:focus { 96 | color: @list-group-link-hover-color; 97 | text-decoration: none; 98 | background-color: @list-group-hover-bg; 99 | } 100 | } 101 | 102 | button.list-group-item { 103 | width: 100%; 104 | text-align: left; 105 | } 106 | 107 | 108 | // Contextual variants 109 | // 110 | // Add modifier classes to change text and background color on individual items. 111 | // Organizationally, this must come after the `:hover` states. 112 | 113 | .list-group-item-variant(success; @state-success-bg; @state-success-text); 114 | .list-group-item-variant(info; @state-info-bg; @state-info-text); 115 | .list-group-item-variant(warning; @state-warning-bg; @state-warning-text); 116 | .list-group-item-variant(danger; @state-danger-bg; @state-danger-text); 117 | 118 | 119 | // Custom content options 120 | // 121 | // Extra classes for creating well-formatted content within `.list-group-item`s. 122 | 123 | .list-group-item-heading { 124 | margin-top: 0; 125 | margin-bottom: 5px; 126 | } 127 | .list-group-item-text { 128 | margin-bottom: 0; 129 | line-height: 1.3; 130 | } 131 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/media.less: -------------------------------------------------------------------------------- 1 | .media { 2 | // Proper spacing between instances of .media 3 | margin-top: 15px; 4 | 5 | &:first-child { 6 | margin-top: 0; 7 | } 8 | } 9 | 10 | .media, 11 | .media-body { 12 | overflow: hidden; 13 | zoom: 1; 14 | } 15 | 16 | .media-body { 17 | width: 10000px; 18 | } 19 | 20 | .media-object { 21 | display: block; 22 | 23 | // Fix collapse in webkit from max-width: 100% and display: table-cell. 24 | &.img-thumbnail { 25 | max-width: none; 26 | } 27 | } 28 | 29 | .media-right, 30 | .media > .pull-right { 31 | padding-left: 10px; 32 | } 33 | 34 | .media-left, 35 | .media > .pull-left { 36 | padding-right: 10px; 37 | } 38 | 39 | .media-left, 40 | .media-right, 41 | .media-body { 42 | display: table-cell; 43 | vertical-align: top; 44 | } 45 | 46 | .media-middle { 47 | vertical-align: middle; 48 | } 49 | 50 | .media-bottom { 51 | vertical-align: bottom; 52 | } 53 | 54 | // Reset margins on headings for tighter default spacing 55 | .media-heading { 56 | margin-top: 0; 57 | margin-bottom: 5px; 58 | } 59 | 60 | // Media list variation 61 | // 62 | // Undo default ul/ol styles 63 | .media-list { 64 | padding-left: 0; 65 | list-style: none; 66 | } 67 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------------------------------- 3 | 4 | // Utilities 5 | @import "mixins/hide-text.less"; 6 | @import "mixins/opacity.less"; 7 | @import "mixins/image.less"; 8 | @import "mixins/labels.less"; 9 | @import "mixins/reset-filter.less"; 10 | @import "mixins/resize.less"; 11 | @import "mixins/responsive-visibility.less"; 12 | @import "mixins/size.less"; 13 | @import "mixins/tab-focus.less"; 14 | @import "mixins/reset-text.less"; 15 | @import "mixins/text-emphasis.less"; 16 | @import "mixins/text-overflow.less"; 17 | @import "mixins/vendor-prefixes.less"; 18 | 19 | // Components 20 | @import "mixins/alerts.less"; 21 | @import "mixins/buttons.less"; 22 | @import "mixins/panels.less"; 23 | @import "mixins/pagination.less"; 24 | @import "mixins/list-group.less"; 25 | @import "mixins/nav-divider.less"; 26 | @import "mixins/forms.less"; 27 | @import "mixins/progress-bar.less"; 28 | @import "mixins/table-row.less"; 29 | 30 | // Skins 31 | @import "mixins/background-variant.less"; 32 | @import "mixins/border-radius.less"; 33 | @import "mixins/gradients.less"; 34 | 35 | // Layout 36 | @import "mixins/clearfix.less"; 37 | @import "mixins/center-block.less"; 38 | @import "mixins/nav-vertical-align.less"; 39 | @import "mixins/grid-framework.less"; 40 | @import "mixins/grid.less"; 41 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/alerts.less: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | .alert-variant(@background; @border; @text-color) { 4 | color: @text-color; 5 | background-color: @background; 6 | border-color: @border; 7 | 8 | hr { 9 | border-top-color: darken(@border, 5%); 10 | } 11 | 12 | .alert-link { 13 | color: darken(@text-color, 10%); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/background-variant.less: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | .bg-variant(@color) { 4 | background-color: @color; 5 | a&:hover, 6 | a&:focus { 7 | background-color: darken(@color, 10%); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/border-radius.less: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | .border-top-radius(@radius) { 4 | border-top-left-radius: @radius; 5 | border-top-right-radius: @radius; 6 | } 7 | .border-right-radius(@radius) { 8 | border-top-right-radius: @radius; 9 | border-bottom-right-radius: @radius; 10 | } 11 | .border-bottom-radius(@radius) { 12 | border-bottom-right-radius: @radius; 13 | border-bottom-left-radius: @radius; 14 | } 15 | .border-left-radius(@radius) { 16 | border-top-left-radius: @radius; 17 | border-bottom-left-radius: @radius; 18 | } 19 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/buttons.less: -------------------------------------------------------------------------------- 1 | // Button variants 2 | // 3 | // Easily pump out default styles, as well as :hover, :focus, :active, 4 | // and disabled options for all buttons 5 | 6 | .button-variant(@color; @background; @border) { 7 | color: @color; 8 | background-color: @background; 9 | border-color: @border; 10 | 11 | &:focus, 12 | &.focus { 13 | color: @color; 14 | background-color: darken(@background, 10%); 15 | border-color: darken(@border, 25%); 16 | } 17 | &:hover { 18 | color: @color; 19 | background-color: darken(@background, 10%); 20 | border-color: darken(@border, 12%); 21 | } 22 | &:active, 23 | &.active, 24 | .open > .dropdown-toggle& { 25 | color: @color; 26 | background-color: darken(@background, 10%); 27 | background-image: none; 28 | border-color: darken(@border, 12%); 29 | 30 | &:hover, 31 | &:focus, 32 | &.focus { 33 | color: @color; 34 | background-color: darken(@background, 17%); 35 | border-color: darken(@border, 25%); 36 | } 37 | } 38 | &.disabled, 39 | &[disabled], 40 | fieldset[disabled] & { 41 | &:hover, 42 | &:focus, 43 | &.focus { 44 | background-color: @background; 45 | border-color: @border; 46 | } 47 | } 48 | 49 | .badge { 50 | color: @background; 51 | background-color: @color; 52 | } 53 | } 54 | 55 | // Button sizes 56 | .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { 57 | padding: @padding-vertical @padding-horizontal; 58 | font-size: @font-size; 59 | line-height: @line-height; 60 | border-radius: @border-radius; 61 | } 62 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/center-block.less: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | .center-block() { 4 | display: block; 5 | margin-right: auto; 6 | margin-left: auto; 7 | } 8 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/clearfix.less: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | .clearfix() { 14 | &:before, 15 | &:after { 16 | display: table; // 2 17 | content: " "; // 1 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/TestImplementation.ReadCookie/wwwroot/lib/bootstrap/less/mixins/forms.less: -------------------------------------------------------------------------------- 1 | // Form validation states 2 | // 3 | // Used in forms.less to generate the form validation CSS for warnings, errors, 4 | // and successes. 5 | 6 | .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) { 7 | // Color the label and help text 8 | .help-block, 9 | .control-label, 10 | .radio, 11 | .checkbox, 12 | .radio-inline, 13 | .checkbox-inline, 14 | &.radio label, 15 | &.checkbox label, 16 | &.radio-inline label, 17 | &.checkbox-inline label { 18 | color: @text-color; 19 | } 20 | // Set the border and box shadow on specific inputs to match 21 | .form-control { 22 | border-color: @border-color; 23 | .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075)); // Redeclare so transitions work 24 | &:focus { 25 | border-color: darken(@border-color, 10%); 26 | @shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px lighten(@border-color, 20%); 27 | .box-shadow(@shadow); 28 | } 29 | } 30 | // Set validation states also for addons 31 | .input-group-addon { 32 | color: @text-color; 33 | background-color: @background-color; 34 | border-color: @border-color; 35 | } 36 | // Optional feedback icon 37 | .form-control-feedback { 38 | color: @text-color; 39 | } 40 | } 41 | 42 | 43 | // Form control focus state 44 | // 45 | // Generate a customized focus state and for any input with the specified color, 46 | // which defaults to the `@input-border-focus` variable. 47 | // 48 | // We highly encourage you to not customize the default value, but instead use 49 | // this to tweak colors on an as-needed basis. This aesthetic change is based on 50 | // WebKit's default styles, but applicable to a wider range of browsers. Its 51 | // usability and accessibility should be taken into account with any change. 52 | // 53 | // Example usage: change the default blue border and shadow to white for better 54 | // contrast against a dark gray background. 55 | .form-control-focus(@color: @input-border-focus) { 56 | @color-rgba: rgba(red(@color), green(@color), blue(@color), .6); 57 | &:focus { 58 | border-color: @color; 59 | outline: 0; 60 | .box-shadow(~"inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px @{color-rgba}"); 61 | } 62 | } 63 | 64 | // Form control sizing 65 | // 66 | // Relative text size, padding, and border-radii changes for form controls. For 67 | // horizontal sizing, wrap controls in the predefined grid classes. ` 18 |
      19 | } 20 | 21 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
      9 |

      Error.

      10 |

      An error occurred while processing your request.

      11 |
      12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 32 |
      33 | @RenderBody() 34 |
      35 |
      36 |

      © @DateTime.Now.Year - My ASP.NET Application

      37 |
      38 |
      39 | 40 | @Scripts.Render("~/bundles/jquery") 41 | @Scripts.Render("~/bundles/bootstrap") 42 | @RenderSection("scripts", required: false) 43 | 44 | 45 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
      7 |
      8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.SetCookie/favicon.ico -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synercoder/FormsAuthentication/537d1592c381821cfd8c3ca00a5658816e10fd2f/samples/TestImplementation.SetCookie/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /samples/TestImplementation.SetCookie/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/CryptoAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | 5 | namespace Synercoding.FormsAuthentication.Encryption 6 | { 7 | // based upon: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/MachineKeyCryptoAlgorithmFactory.cs 8 | internal sealed class CryptoAlgorithmFactory : ICryptoAlgorithmFactory 9 | { 10 | 11 | private readonly FormsAuthenticationOptions _options; 12 | private Func _encryptionAlgorithmFactory; 13 | private Func _validationAlgorithmFactory; 14 | 15 | public CryptoAlgorithmFactory(FormsAuthenticationOptions options) 16 | { 17 | _options = options; 18 | } 19 | 20 | public SymmetricAlgorithm GetEncryptionAlgorithm() 21 | { 22 | if (_encryptionAlgorithmFactory == null) 23 | { 24 | _encryptionAlgorithmFactory = GetEncryptionAlgorithmFactory(); 25 | } 26 | return _encryptionAlgorithmFactory(); 27 | } 28 | 29 | private Func GetEncryptionAlgorithmFactory() 30 | { 31 | switch (_options.EncryptionMethod) 32 | { 33 | case EncryptionMethod.AES: 34 | return CryptoAlgorithms.CreateAes; 35 | case EncryptionMethod.TripleDES: 36 | return CryptoAlgorithms.CreateTripleDES; 37 | default: 38 | throw new InvalidDataException(); 39 | } 40 | } 41 | 42 | public KeyedHashAlgorithm GetValidationAlgorithm() 43 | { 44 | if (_validationAlgorithmFactory == null) 45 | { 46 | _validationAlgorithmFactory = GetValidationAlgorithmFactory(); 47 | } 48 | return _validationAlgorithmFactory(); 49 | } 50 | 51 | private Func GetValidationAlgorithmFactory() 52 | { 53 | switch (_options.ValidationMethod) 54 | { 55 | case ValidationMethod.SHA1: 56 | return CryptoAlgorithms.CreateHMACSHA1; 57 | case ValidationMethod.HMACSHA256: 58 | return CryptoAlgorithms.CreateHMACSHA256; 59 | case ValidationMethod.HMACSHA384: 60 | return CryptoAlgorithms.CreateHMACSHA384; 61 | case ValidationMethod.HMACSHA512: 62 | return CryptoAlgorithms.CreateHMACSHA512; 63 | default: 64 | throw new InvalidDataException(); 65 | } 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/CryptoAlgorithms.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Security.Cryptography; 4 | 5 | namespace Synercoding.FormsAuthentication.Encryption 6 | { 7 | // taken from: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/CryptoAlgorithms.cs 8 | internal static class CryptoAlgorithms 9 | { 10 | internal static Aes CreateAes() 11 | { 12 | return Aes.Create(); 13 | } 14 | 15 | [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:SHA1CannotBeUsed", Justification = @"This is only used by legacy code; new features do not use this algorithm.")] 16 | internal static HMACSHA1 CreateHMACSHA1() 17 | { 18 | return new HMACSHA1(); 19 | } 20 | 21 | internal static HMACSHA256 CreateHMACSHA256() 22 | { 23 | return new HMACSHA256(); 24 | } 25 | 26 | internal static HMACSHA384 CreateHMACSHA384() 27 | { 28 | return new HMACSHA384(); 29 | } 30 | 31 | internal static HMACSHA512 CreateHMACSHA512() 32 | { 33 | return new HMACSHA512(); 34 | } 35 | 36 | internal static HMACSHA512 CreateHMACSHA512(byte[] key) 37 | { 38 | return new HMACSHA512(key); 39 | } 40 | 41 | internal static SHA256 CreateSHA256() 42 | { 43 | return SHA256.Create(); 44 | } 45 | 46 | [SuppressMessage("Microsoft.Cryptographic.Standard", "CA5353:TripleDESCannotBeUsed", Justification = @"This is only used by legacy code; new features do not use this algorithm.")] 47 | [Obsolete("3DES is deprecated and MUST NOT be used by new features. Consider using AES instead.")] 48 | internal static TripleDES CreateTripleDES() 49 | { 50 | return TripleDES.Create(); 51 | } 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/CryptographicKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace Synercoding.FormsAuthentication.Encryption 5 | { 6 | // Copied from: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/CryptographicKey.cs 7 | internal sealed class CryptographicKey 8 | { 9 | 10 | private readonly byte[] _keyMaterial; 11 | 12 | public CryptographicKey(byte[] keyMaterial) 13 | { 14 | _keyMaterial = keyMaterial; 15 | } 16 | 17 | // Returns the length of the key (in bits). 18 | public int KeyLength 19 | { 20 | get 21 | { 22 | return checked(_keyMaterial.Length * 8); 23 | } 24 | } 25 | 26 | // Extracts the specified number of bits at the specified offset 27 | // and returns a new CryptographicKey. This is not appropriate 28 | // for subkey derivation, but it can be used if this cryptographic 29 | // key is actually two keys (like encryption + validation) 30 | // concatenated together. Inputs are specified as bit lengths. 31 | public CryptographicKey ExtractBits(int offset, int count) 32 | { 33 | Debug.Assert(offset % 8 == 0, "Offset must be divisible by 8."); 34 | Debug.Assert(count % 8 == 0, "Count must be divisible by 8."); 35 | 36 | int offsetBytes = offset / 8; 37 | int countBytes = count / 8; 38 | 39 | byte[] newKey = new byte[countBytes]; 40 | Buffer.BlockCopy(_keyMaterial, offsetBytes, newKey, 0, countBytes); 41 | return new CryptographicKey(newKey); 42 | } 43 | 44 | // Returns the raw key material as a byte array. 45 | public byte[] GetKeyMaterial() 46 | { 47 | return _keyMaterial; 48 | } 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/HomogenizingCryptoServiceWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | 4 | namespace Synercoding.FormsAuthentication.Encryption 5 | { 6 | // Based upon: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/HomogenizingCryptoServiceWrapper.cs 7 | internal sealed class HomogenizingCryptoServiceWrapper : ICryptoService 8 | { 9 | 10 | public HomogenizingCryptoServiceWrapper(ICryptoService wrapped) 11 | { 12 | WrappedCryptoService = wrapped; 13 | } 14 | 15 | internal ICryptoService WrappedCryptoService 16 | { 17 | get; 18 | private set; 19 | } 20 | 21 | private static byte[] HomogenizeErrors(Func func, byte[] input) 22 | { 23 | // If the underlying method returns null or throws an exception, the 24 | // error will be homogenized as a single CryptographicException. 25 | 26 | byte[] output = null; 27 | 28 | try 29 | { 30 | output = func(input); 31 | return output; 32 | } 33 | finally 34 | { 35 | if (output == null) 36 | { 37 | throw new CryptographicException(); 38 | } 39 | } 40 | } 41 | 42 | public byte[] Protect(byte[] clearData) 43 | { 44 | return HomogenizeErrors(WrappedCryptoService.Protect, clearData); 45 | } 46 | 47 | public byte[] Unprotect(byte[] protectedData) 48 | { 49 | return HomogenizeErrors(WrappedCryptoService.Unprotect, protectedData); 50 | } 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/ICryptoAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | 3 | namespace Synercoding.FormsAuthentication.Encryption 4 | { 5 | // Copied from: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/ICryptoAlgorithmFactory.cs 6 | internal interface ICryptoAlgorithmFactory 7 | { 8 | 9 | // Gets a SymmetricAlgorithm instance that can be used for encryption / decryption 10 | SymmetricAlgorithm GetEncryptionAlgorithm(); 11 | 12 | // Gets a KeyedHashAlgorithm instance that can be used for signing / validation 13 | KeyedHashAlgorithm GetValidationAlgorithm(); 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/ICryptoService.cs: -------------------------------------------------------------------------------- 1 | namespace Synercoding.FormsAuthentication.Encryption 2 | { 3 | // Copied from: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/ICryptoService.cs 4 | internal interface ICryptoService 5 | { 6 | 7 | // Protects some data by applying appropriate cryptographic transformations to it. 8 | byte[] Protect(byte[] clearData); 9 | 10 | // Returns the unprotected form of some protected data by validating and undoing the cryptographic transformations that led to it. 11 | byte[] Unprotect(byte[] protectedData); 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/IMasterKeyProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Synercoding.FormsAuthentication.Encryption 2 | { 3 | // Copied from: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/IMasterKeyProvider.cs 4 | internal interface IMasterKeyProvider 5 | { 6 | 7 | // encryption + decryption key 8 | CryptographicKey GetEncryptionKey(); 9 | 10 | // signing + validation key 11 | CryptographicKey GetValidationKey(); 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/MasterKeyProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Synercoding.FormsAuthentication.Encryption 4 | { 5 | // Lossly based upon: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/Cryptography/MachineKeyMasterKeyProvider.cs 6 | // Removed auto-gen functionality and replaced config requirement 7 | internal sealed class MasterKeyProvider : IMasterKeyProvider 8 | { 9 | private CryptographicKey _encryptionKey; 10 | private readonly FormsAuthenticationOptions _options; 11 | private CryptographicKey _validationKey; 12 | 13 | // the only required parameter is 'machineKeySection'; other parameters are just used for unit testing 14 | internal MasterKeyProvider(FormsAuthenticationOptions machineKeySection) 15 | { 16 | _options = machineKeySection; 17 | } 18 | 19 | private CryptographicKey GenerateCryptographicKey(string configAttributeValue) 20 | { 21 | byte[] keyMaterial = CryptoUtil.HexToBinary(configAttributeValue); 22 | 23 | // If contained a valid key, just use it verbatim. 24 | if (keyMaterial != null && keyMaterial.Length > 0) 25 | { 26 | return new CryptographicKey(keyMaterial); 27 | } 28 | 29 | throw new Exception(); 30 | } 31 | 32 | public CryptographicKey GetEncryptionKey() 33 | { 34 | if (_encryptionKey == null) 35 | _encryptionKey = GenerateCryptographicKey(_options.DecryptionKey); 36 | return _encryptionKey; 37 | } 38 | 39 | public CryptographicKey GetValidationKey() 40 | { 41 | if (_validationKey == null) 42 | _validationKey = GenerateCryptographicKey(_options.ValidationKey); 43 | return _validationKey; 44 | } 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/SerializingBinaryReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Synercoding.FormsAuthentication.Encryption 5 | { 6 | // Copied from private sub-class in: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/FormsAuthenticationTicketSerializer.cs 7 | internal sealed class SerializingBinaryReader : BinaryReader 8 | { 9 | public SerializingBinaryReader(Stream input) 10 | : base(input) 11 | { 12 | } 13 | 14 | public string ReadBinaryString() 15 | { 16 | int charCount = Read7BitEncodedInt(); 17 | byte[] bytes = ReadBytes(charCount * 2); 18 | 19 | char[] chars = new char[charCount]; 20 | for (int i = 0; i < chars.Length; i++) 21 | { 22 | chars[i] = (char)(bytes[2 * i] | (bytes[2 * i + 1] << 8)); 23 | } 24 | 25 | return new String(chars); 26 | } 27 | 28 | public override string ReadString() 29 | { 30 | // should never call this method since it will produce wrong results 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Encryption/SerializingBinaryWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Synercoding.FormsAuthentication.Encryption 5 | { 6 | // Copied from private sub-class in: https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/FormsAuthenticationTicketSerializer.cs 7 | internal sealed class SerializingBinaryWriter : BinaryWriter 8 | { 9 | public SerializingBinaryWriter(Stream output) 10 | : base(output) 11 | { 12 | } 13 | 14 | public override void Write(string value) 15 | { 16 | // should never call this method since it will produce wrong results 17 | throw new NotImplementedException(); 18 | } 19 | 20 | public void WriteBinaryString(string value) 21 | { 22 | byte[] bytes = new byte[value.Length * 2]; 23 | for (int i = 0; i < value.Length; i++) 24 | { 25 | char c = value[i]; 26 | bytes[2 * i] = (byte)c; 27 | bytes[2 * i + 1] = (byte)(c >> 8); 28 | } 29 | 30 | Write7BitEncodedInt(value.Length); 31 | Write(bytes); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/EncryptionMethod.cs: -------------------------------------------------------------------------------- 1 | namespace Synercoding.FormsAuthentication 2 | { 3 | public enum EncryptionMethod 4 | { 5 | AES, 6 | TripleDES 7 | } 8 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/FormsAuthenticationCookie.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Synercoding.FormsAuthentication 4 | { 5 | public class FormsAuthenticationCookie 6 | { 7 | public byte Version { get; set; } 8 | public DateTime IssuedUtc { get; set; } 9 | public DateTime ExpiresUtc { get; set; } 10 | public bool IsPersistent { get; set; } 11 | public string UserName { get; set; } 12 | public string UserData { get; set; } 13 | public string CookiePath { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/FormsAuthenticationDataFormat.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authentication; 2 | using System; 3 | 4 | namespace Synercoding.FormsAuthentication 5 | { 6 | public class FormsAuthenticationDataFormat : ISecureDataFormat 7 | where TData : AuthenticationTicket 8 | { 9 | private readonly Func _convertFrom; 10 | private readonly Func _convertTo; 11 | private readonly FormsAuthenticationCryptor _cryptor; 12 | 13 | public FormsAuthenticationDataFormat(FormsAuthenticationOptions options, Func from, Func to) 14 | { 15 | _cryptor = new FormsAuthenticationCryptor(options); 16 | _convertFrom = from; 17 | _convertTo = to; 18 | } 19 | 20 | public string Protect(TData data) 21 | { 22 | return Protect(data, null); 23 | } 24 | 25 | public string Protect(TData data, string purpose) 26 | { 27 | var cookie = _convertTo(data); 28 | return _cryptor.Protect(cookie); 29 | } 30 | 31 | public TData Unprotect(string protectedText) 32 | { 33 | return Unprotect(protectedText, null); 34 | } 35 | 36 | public TData Unprotect(string protectedText, string purpose) 37 | { 38 | try 39 | { 40 | var cookie = _cryptor.Unprotect(protectedText); 41 | return _convertFrom(cookie); 42 | } 43 | catch 44 | { 45 | return default(TData); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/FormsAuthenticationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Synercoding.FormsAuthentication 2 | { 3 | public class FormsAuthenticationOptions 4 | { 5 | public EncryptionMethod EncryptionMethod { get; set; } = EncryptionMethod.AES; 6 | public ValidationMethod ValidationMethod { get; set; } = ValidationMethod.HMACSHA256; 7 | 8 | public string DecryptionKey { get; set; } 9 | public string ValidationKey { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/Synercoding.FormsAuthentication.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | True 6 | With this package you can use ASP.NET Forms Authentication, alot of the code for this package was taken (and altered) from https://github.com/Microsoft/referencesource/tree/master/System.Web/Security under MIT license. 7 | Synercoding 8 | Synercoding 9 | 2.1.0 10 | 2.1.0.0 11 | https://opensource.org/licenses/MIT 12 | false 13 | 2.1.0.0 14 | https://github.com/synercoder/FormsAuthentication 15 | https://github.com/synercoder/FormsAuthentication 16 | en 17 | Mickaël Derriey (@mderriey) fixed issue #2 in pull #3: Return default value when an exception is thrown while unprotecting data 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Synercoding.FormsAuthentication/ValidationMethod.cs: -------------------------------------------------------------------------------- 1 | namespace Synercoding.FormsAuthentication 2 | { 3 | public enum ValidationMethod 4 | { 5 | SHA1, 6 | HMACSHA256, 7 | HMACSHA384, 8 | HMACSHA512 9 | } 10 | } --------------------------------------------------------------------------------