Reorganize repo branch and project folder structure
When the code lived in dotnet/templating, the 1.x, 2.0, and 2.1 templates all needed to sit side-by-side. Now that this code builds from aspnet/templating, we're reorganizing the folder and branch structure to match the aspnetcore runtime repos. Branches: rel/1.1.5 = Microsoft.DotNet.Web.ProjectTemplates.1.x rel/2.0.3 = Microsoft.DotNet.Web.ProjectTemplates.2.0 dev = Microsoft.DotNet.Web.ProjectTemplates.2.1 Changes: Remove the 2.0 and 1.x templates projects from this branch
This commit is contained in:
Родитель
dac7451023
Коммит
09161305bb
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.16
|
||||
|
@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Templates.Test", "test\Temp
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.ItemTemplates", "src\Microsoft.DotNet.Web.ItemTemplates\Microsoft.DotNet.Web.ItemTemplates.csproj", "{ABC9D95C-7FBD-4F8D-827A-00942EA3D0C0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.ProjectTemplates.1.x", "src\Microsoft.DotNet.Web.ProjectTemplates.1.x\Microsoft.DotNet.Web.ProjectTemplates.1.x.csproj", "{B8EB8821-9B58-465A-9693-5F9289AA7B29}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.ProjectTemplates.2.0", "src\Microsoft.DotNet.Web.ProjectTemplates.2.0\Microsoft.DotNet.Web.ProjectTemplates.2.0.csproj", "{62D00388-8824-4661-8CC8-8D8436FF97E6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TemplatePackages", "TemplatePackages", "{0AD6E692-E423-408C-B523-DAFB19412E4B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DependencyUpdater", "tools\DependencyUpdater\DependencyUpdater.csproj", "{15806338-550D-4418-99AE-42FDAE03808A}"
|
||||
|
@ -21,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.Spa.Pr
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.Client.ItemTemplates", "src\Microsoft.DotNet.Web.Client.ItemTemplates\Microsoft.DotNet.Web.Client.ItemTemplates.csproj", "{1731F6D9-1DFC-49D6-8F28-471194B1962C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.ProjectTemplates.2.1", "src\Microsoft.DotNet.Web.ProjectTemplates.2.1\Microsoft.DotNet.Web.ProjectTemplates.2.1.csproj", "{260EBA09-DEF5-429C-99BF-90CA1456A576}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Web.ProjectTemplates", "src\Microsoft.DotNet.Web.ProjectTemplates\Microsoft.DotNet.Web.ProjectTemplates.csproj", "{260EBA09-DEF5-429C-99BF-90CA1456A576}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{973DC5B6-710B-4FC8-AF20-E94B93859DE8}"
|
||||
EndProject
|
||||
|
@ -41,14 +37,6 @@ Global
|
|||
{ABC9D95C-7FBD-4F8D-827A-00942EA3D0C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ABC9D95C-7FBD-4F8D-827A-00942EA3D0C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ABC9D95C-7FBD-4F8D-827A-00942EA3D0C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B8EB8821-9B58-465A-9693-5F9289AA7B29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B8EB8821-9B58-465A-9693-5F9289AA7B29}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B8EB8821-9B58-465A-9693-5F9289AA7B29}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B8EB8821-9B58-465A-9693-5F9289AA7B29}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{62D00388-8824-4661-8CC8-8D8436FF97E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{62D00388-8824-4661-8CC8-8D8436FF97E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{62D00388-8824-4661-8CC8-8D8436FF97E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{62D00388-8824-4661-8CC8-8D8436FF97E6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{15806338-550D-4418-99AE-42FDAE03808A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{15806338-550D-4418-99AE-42FDAE03808A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{15806338-550D-4418-99AE-42FDAE03808A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -79,8 +67,6 @@ Global
|
|||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{ABC9D95C-7FBD-4F8D-827A-00942EA3D0C0} = {0AD6E692-E423-408C-B523-DAFB19412E4B}
|
||||
{B8EB8821-9B58-465A-9693-5F9289AA7B29} = {0AD6E692-E423-408C-B523-DAFB19412E4B}
|
||||
{62D00388-8824-4661-8CC8-8D8436FF97E6} = {0AD6E692-E423-408C-B523-DAFB19412E4B}
|
||||
{15806338-550D-4418-99AE-42FDAE03808A} = {973DC5B6-710B-4FC8-AF20-E94B93859DE8}
|
||||
{01E12D5E-8540-4BC8-9A54-41EDD55E762E} = {0AD6E692-E423-408C-B523-DAFB19412E4B}
|
||||
{402E62D1-7FD0-4E07-812C-0E385D98D6D9} = {0AD6E692-E423-408C-B523-DAFB19412E4B}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NuspecFile>Microsoft.DotNet.Web.ProjectTemplates.1.x.nuspec</NuspecFile>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Microsoft.DotNet.Web.ProjectTemplates.1.x</id>
|
||||
<version>$version$</version>
|
||||
<authors>Microsoft</authors>
|
||||
<description>ASP.NET Core Web Template Pack for Microsoft Template Engine</description>
|
||||
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
|
||||
<language>en-US</language>
|
||||
<projectUrl>https://github.com/dotnet/templating</projectUrl>
|
||||
<licenseUrl>https://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
|
||||
<copyright>Copyright © Microsoft Corporation</copyright>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<tags>aspnet templates</tags>
|
||||
<packageTypes>
|
||||
<packageType name="Template" />
|
||||
</packageTypes>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="content/**" target="" />
|
||||
</files>
|
||||
</package>
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"isHidden": "true"
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"KestrelPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IncludeLaunchSettings": {
|
||||
"isHidden": true
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1"
|
||||
]
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "Empty"],
|
||||
"name": "ASP.NET Core Empty",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "An empty project template for creating an ASP.NET Core application. This template does not have any content in it.",
|
||||
"groupIdentity": "Microsoft.Web.Empty",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.Empty.CSharp",
|
||||
"shortName": "web",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"sources": [
|
||||
{
|
||||
"modifiers": [
|
||||
{
|
||||
"condition": "(!IncludeLaunchSettings && !WindowsAuth)",
|
||||
"exclude": [
|
||||
"Properties/launchSettings.json"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"IncludeLaunchSettings": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to include launchSettings.json in the generated template."
|
||||
},
|
||||
"KestrelPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure Kestrel in launchSettings.json."
|
||||
},
|
||||
"KestrelPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"KestrelPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "KestrelPort",
|
||||
"fallbackVariableName": "KestrelPortGenerated"
|
||||
},
|
||||
"replaces": "5000"
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure IIS Express in launchSettings.json."
|
||||
},
|
||||
"IISExpressPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"IISExpressPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "IISExpressPort",
|
||||
"fallbackVariableName": "IISExpressPortGenerated"
|
||||
},
|
||||
"replaces": "55556"
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include Application Insights in the project"
|
||||
},
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.csproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/vs-2017.3.host",
|
||||
"name": {
|
||||
"text": "Empty",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1011"
|
||||
},
|
||||
"description": {
|
||||
"text": "An empty project template for creating an ASP.NET Core application. This template does not have any content in it.",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1012"
|
||||
},
|
||||
"order": 100,
|
||||
"icon": "vs-2017.3/Empty.png",
|
||||
"learnMoreLink": "https://go.microsoft.com/fwlink/?LinkID=784883",
|
||||
"uiFilters": [ "oneaspnet" ],
|
||||
"supportsDocker": true,
|
||||
"legacyTemplateIdentity": "Microsoft.NetCore.CSharp.EmptyWeb",
|
||||
"ports": [
|
||||
{
|
||||
"name": "IISExpressPort",
|
||||
"useHttps": false
|
||||
},
|
||||
{
|
||||
"name": "KestrelPort",
|
||||
"useHttps": false
|
||||
}
|
||||
],
|
||||
"includeLaunchSettings": true
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" Condition="'$(Framework)' != 'netcoreapp1.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" Condition="'$(Framework)' == 'netcoreapp1.1'" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
#if (IncludeApplicationInsights)
|
||||
.UseApplicationInsights()
|
||||
#endif
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:55556/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000/"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.Run(async (context) =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello World!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"isHidden": "true"
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1"
|
||||
]
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "Empty"],
|
||||
"name": "ASP.NET Core Empty",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "An empty project template for creating an ASP.NET Core application. This template does not have any content in it.",
|
||||
"groupIdentity": "Microsoft.Web.Empty",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.Empty.FSharp",
|
||||
"shortName": "web",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "F#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"symbols": {
|
||||
"IncludeApplicationInsights": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include Application Insights in the project"
|
||||
},
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.fsproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Startup.fs" />
|
||||
<Compile Include="Program.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" Condition="'$(Framework)' != 'netcoreapp1.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" Condition="'$(Framework)' == 'netcoreapp1.1'" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,25 +0,0 @@
|
|||
namespace Company.WebApplication1
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
open Microsoft.AspNetCore.Hosting
|
||||
|
||||
module Program =
|
||||
let exitCode = 0
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args =
|
||||
let host =
|
||||
WebHostBuilder()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseKestrel()
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
#if (IncludeApplicationInsights)
|
||||
.UseApplicationInsights()
|
||||
#endif
|
||||
.Build()
|
||||
|
||||
host.Run()
|
||||
|
||||
exitCode
|
|
@ -1,22 +0,0 @@
|
|||
namespace Company.WebApplication1
|
||||
|
||||
open System
|
||||
open Microsoft.AspNetCore.Builder
|
||||
open Microsoft.AspNetCore.Hosting
|
||||
open Microsoft.AspNetCore.Http
|
||||
open Microsoft.Extensions.DependencyInjection
|
||||
open Microsoft.Extensions.Logging
|
||||
|
||||
type Startup() =
|
||||
|
||||
member this.ConfigureServices(services: IServiceCollection) =
|
||||
()
|
||||
|
||||
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment, log: ILoggerFactory) =
|
||||
log.AddConsole() |> ignore
|
||||
|
||||
if env.IsDevelopment() then app.UseDeveloperExceptionPage() |> ignore
|
||||
|
||||
app.Run(fun context -> context.Response.WriteAsync("Hello World!"))
|
||||
|
||||
()
|
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"isHidden": "true"
|
||||
},
|
||||
"UseLocalDB": {
|
||||
"longName": "use-local-db"
|
||||
},
|
||||
"AADInstance": {
|
||||
"longName": "aad-instance",
|
||||
"shortName": ""
|
||||
},
|
||||
"OrgReadAccess": {
|
||||
"longName": "org-read-access",
|
||||
"shortName": "r"
|
||||
},
|
||||
"ClientId": {
|
||||
"longName": "client-id",
|
||||
"shortName": ""
|
||||
},
|
||||
"Domain": {
|
||||
"longName": "domain",
|
||||
"shortName": ""
|
||||
},
|
||||
"TenantId": {
|
||||
"longName": "tenant-id",
|
||||
"shortName": ""
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"NoTools": {
|
||||
"isHidden": "true",
|
||||
"longName": "no-tools"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"HttpsPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"KestrelPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IncludeLaunchSettings": {
|
||||
"isHidden": true
|
||||
},
|
||||
"UserSecretsId": {
|
||||
"isHidden": true
|
||||
},
|
||||
"UseBrowserLink": {
|
||||
"longName": "use-browserlink",
|
||||
"shortName": ""
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1 --auth Individual"
|
||||
]
|
||||
}
|
|
@ -1,317 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "MVC"],
|
||||
"name": "ASP.NET Core Web App (Model-View-Controller)",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "A project template for creating an ASP.NET Core application with example ASP.NET Core MVC Views and Controllers. This template can also be used for RESTful HTTP services.",
|
||||
"groupIdentity": "Microsoft.Web.Mvc",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.Mvc.CSharp",
|
||||
"shortName": "mvc",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"guids": [ "53bc9b9d-9d6a-45d4-8429-2a2761773502" ],
|
||||
"sources": [
|
||||
{
|
||||
"modifiers": [
|
||||
{
|
||||
"condition": "(!IndividualAuth && !OrganizationalAuth)",
|
||||
"exclude": [
|
||||
"Controllers/AccountController.cs",
|
||||
"Views/Account/**",
|
||||
"Views/Manage/**",
|
||||
"Views/Shared/_LoginPartial.cshtml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(UseLocalDB || !IndividualAuth)",
|
||||
"exclude": [
|
||||
"*.db"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(!IndividualAuth)",
|
||||
"exclude": [
|
||||
"Controllers/ManageController.cs",
|
||||
"Views/Account/ConfirmEmail.cshtml",
|
||||
"Views/Account/ExternalLoginConfirmation.cshtml",
|
||||
"Views/Account/ExternalLoginFailure.cshtml",
|
||||
"Views/Account/ForgotPassword.cshtml",
|
||||
"Views/Account/ForgotPasswordConfirmation.cshtml",
|
||||
"Views/Account/Lockout.cshtml",
|
||||
"Views/Account/Login.cshtml",
|
||||
"Views/Account/Register.cshtml",
|
||||
"Views/Account/ResetPassword.cshtml",
|
||||
"Views/Account/ResetPasswordConfirmation.cshtml",
|
||||
"Views/Account/SendCode.cshtml",
|
||||
"Views/Account/VerifyCode.cshtml",
|
||||
"Views/Manage/AddPhoneNumber.cshtml",
|
||||
"Views/Manage/ChangePassword.cshtml",
|
||||
"Views/Manage/Index.cshtml",
|
||||
"Views/Manage/ManageLogins.cshtml",
|
||||
"Views/Manage/SetPassword.cshtml",
|
||||
"Views/Manage/VerifyPhoneNumber.cshtml",
|
||||
"Services/**",
|
||||
"Data/**",
|
||||
"Models/**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(!IncludeLaunchSettings && !WindowsAuth)",
|
||||
"exclude": [
|
||||
"Properties/launchSettings.json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(IndividualAuth)",
|
||||
"exclude": [
|
||||
"Views/Account/SignedOut.cshtml"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"auth": {
|
||||
"type": "parameter",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "None",
|
||||
"description": "No authentication"
|
||||
},
|
||||
{
|
||||
"choice": "Individual",
|
||||
"description": "Individual authentication"
|
||||
},
|
||||
{
|
||||
"choice": "SingleOrg",
|
||||
"description": "Organizational authentication for a single tenant"
|
||||
},
|
||||
{
|
||||
"choice": "MultiOrg",
|
||||
"description": "Organizational authentication for multiple tenants"
|
||||
},
|
||||
{
|
||||
"choice": "Windows",
|
||||
"description": "Windows authentication"
|
||||
}
|
||||
],
|
||||
"defaultValue": "None",
|
||||
"description": "The type of authentication to use"
|
||||
},
|
||||
"AADInstance": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"defaultValue": "https://login.microsoftonline.com/",
|
||||
"replaces": "https:////login.microsoftonline.com/",
|
||||
"description": "The Azure Active Directory instance to connect to (use with SingleOrg or MultiOrg auth)."
|
||||
},
|
||||
"ClientId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "11111111-1111-1111-11111111111111111",
|
||||
"description": "The Client ID for this project (use with SingleOrg or MultiOrg auth)."
|
||||
},
|
||||
"Domain": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "qualified.domain.name",
|
||||
"description": "The domain owning the directory (use with SingleOrg auth)."
|
||||
},
|
||||
"TenantId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "22222222-2222-2222-2222-222222222222",
|
||||
"description": "The TenantId ID of the directory to connect to (use with SingleOrg auth)."
|
||||
},
|
||||
"OrgReadAccess": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to allow this application read access to the directory (only applies to SingleOrg or MultiOrg auth)."
|
||||
},
|
||||
"UserSecretsId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502",
|
||||
"defaultValue": "aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502",
|
||||
"description": "The ID to use for secrets (use with OrgReadAccess or Individual auth)."
|
||||
},
|
||||
"IncludeLaunchSettings": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to include launchSettings.json in the generated template."
|
||||
},
|
||||
"HttpsPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure SSL in launchSettings.json."
|
||||
},
|
||||
"HttpsPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port",
|
||||
"parameters": {
|
||||
"low": 44300,
|
||||
"high": 44399
|
||||
}
|
||||
},
|
||||
"HttpsPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "HttpsPort",
|
||||
"fallbackVariableName": "HttpsPortGenerated"
|
||||
},
|
||||
"replaces": "43434"
|
||||
},
|
||||
"KestrelPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure Kestrel in launchSettings.json."
|
||||
},
|
||||
"KestrelPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"KestrelPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "KestrelPort",
|
||||
"fallbackVariableName": "KestrelPortGenerated"
|
||||
},
|
||||
"replaces": "5001"
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure IIS Express in launchSettings.json."
|
||||
},
|
||||
"IISExpressPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"IISExpressPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "IISExpressPort",
|
||||
"fallbackVariableName": "IISExpressPortGenerated"
|
||||
},
|
||||
"replaces": "55556"
|
||||
},
|
||||
"OrganizationalAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"SingleOrg\" || auth == \"MultiOrg\")"
|
||||
},
|
||||
"WindowsAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"Windows\")"
|
||||
},
|
||||
"MultiOrgAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"MultiOrg\")"
|
||||
},
|
||||
"SingleOrgAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"SingleOrg\")"
|
||||
},
|
||||
"IndividualAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"Individual\")"
|
||||
},
|
||||
"NoAuth": {
|
||||
"type": "computed",
|
||||
"value": "(!(IndividualAuth || MultiOrgAuth || SingleOrgAuth || WindowsAuth))"
|
||||
},
|
||||
"RequiresHttps": {
|
||||
"type": "computed",
|
||||
"value": "(OrganizationalAuth)"
|
||||
},
|
||||
"UseLocalDB": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified."
|
||||
},
|
||||
"UseBrowserLink": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include BrowserLink in the project"
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include Application Insights in the project"
|
||||
},
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"FrameworkIs1_1": {
|
||||
"type": "computed",
|
||||
"value": "Framework == \"netcoreapp1.1\""
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"NoTools": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.csproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/vs-2017.3.host",
|
||||
"name": {
|
||||
"text": "Web Application (Model-View-Controller)",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1015"
|
||||
},
|
||||
"description": {
|
||||
"text": "A project template for creating an ASP.NET Core application with example ASP.NET Core MVC Views and Controllers. This template can also be used for RESTful HTTP services.",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1016"
|
||||
},
|
||||
"order": 300,
|
||||
"icon": "vs-2017.3/WebApplication.png",
|
||||
"learnMoreLink": "https://go.microsoft.com/fwlink/?LinkID=784881",
|
||||
"uiFilters": [ "oneaspnet" ],
|
||||
"supportsDocker": true,
|
||||
"isApi": false,
|
||||
"usesOidc": true,
|
||||
"useBrowserLink": true,
|
||||
"legacyTemplateIdentity": "Microsoft.NetCore.CSharp.StarterWeb",
|
||||
"supportedAuthentications": [
|
||||
{
|
||||
"auth": "None",
|
||||
"authenticationType": "NoAuth"
|
||||
},
|
||||
{
|
||||
"auth": "Individual",
|
||||
"authenticationType": "IndividualAuth"
|
||||
},
|
||||
{
|
||||
"auth": "SingleOrg",
|
||||
"authenticationType": "OrgAuth",
|
||||
"orgAuthenticationOptions": "SSO"
|
||||
},
|
||||
{
|
||||
"auth": "MultiOrg",
|
||||
"authenticationType": "OrgAuth",
|
||||
"orgAuthenticationOptions": "MultiOrg"
|
||||
},
|
||||
{
|
||||
"auth": "Windows",
|
||||
"authenticationType": "WindowsAuth"
|
||||
}
|
||||
],
|
||||
"ports": [
|
||||
{
|
||||
"name": "IISExpressPort",
|
||||
"useHttps": false
|
||||
},
|
||||
{
|
||||
"name": "KestrelPort",
|
||||
"useHttps": false
|
||||
},
|
||||
{
|
||||
"name": "HttpsPort",
|
||||
"useHttps": true
|
||||
}
|
||||
],
|
||||
"azureReplyUrlPortName": "HttpsPort",
|
||||
"includeLaunchSettings": true
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
|
||||
<UserSecretsId Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'">aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502</UserSecretsId>
|
||||
<WebProject_DirectoryAccessLevelKey Condition="'$(OrganizationalAuth)' == 'True' AND '$(OrgReadAccess)' != 'True'">0</WebProject_DirectoryAccessLevelKey>
|
||||
<WebProject_DirectoryAccessLevelKey Condition="'$(OrganizationalAuth)' == 'True' AND '$(OrgReadAccess)' == 'True'">1</WebProject_DirectoryAccessLevelKey>
|
||||
</PropertyGroup>
|
||||
<!--#if (IndividualAuth && UseLocalDB) -->
|
||||
|
||||
<!--#endif -->
|
||||
<ItemGroup Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' != 'True' ">
|
||||
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Framework)' != 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.0.5" Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.0.5" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.0.5" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.0.5" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.0.6" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.0.6" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' != 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.0.6" PrivateAssets="All" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' != 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.6" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' == 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.0.6" PrivateAssets="All" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' == 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.3" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.2" Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.3" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" Condition="'$(UseBrowserLink)' == 'True'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Framework)' == 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.3" Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.1.3" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.4" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.4" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.4" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.4" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' != 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.4" PrivateAssets="All" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' != 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.4" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' == 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.4" PrivateAssets="All" Condition=" '$(IndividualAuth)' == 'True' AND '$(UseLocalDB)' == 'True' " />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.4" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.3" PrivateAssets="All" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.3" Condition="'$(UseBrowserLink)' == 'True'" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(NoTools)' != 'True'">
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.3" Condition="'$(IndividualAuth)' == 'True'" />
|
||||
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.1" Condition="'$(IndividualAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,529 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if (IndividualAuth)
|
||||
using System.Security.Claims;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
#if (OrganizationalAuth)
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.Http.Authentication;
|
||||
#endif
|
||||
#if (IndividualAuth)
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
#if (IndividualAuth)
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Company.WebApplication1.Models;
|
||||
using Company.WebApplication1.Models.AccountViewModels;
|
||||
using Company.WebApplication1.Services;
|
||||
#endif
|
||||
|
||||
namespace Company.WebApplication1.Controllers
|
||||
{
|
||||
#if (IndividualAuth)
|
||||
[Authorize]
|
||||
#endif
|
||||
public class AccountController : Controller
|
||||
{
|
||||
#if (OrganizationalAuth)
|
||||
//
|
||||
// GET: /Account/SignIn
|
||||
[HttpGet]
|
||||
public IActionResult SignIn()
|
||||
{
|
||||
return Challenge(
|
||||
new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/SignOut
|
||||
[HttpGet]
|
||||
public IActionResult SignOut()
|
||||
{
|
||||
var callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
|
||||
return SignOut(new AuthenticationProperties { RedirectUri = callbackUrl },
|
||||
CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/SignedOut
|
||||
[HttpGet]
|
||||
public IActionResult SignedOut()
|
||||
{
|
||||
if (HttpContext.User.Identity.IsAuthenticated)
|
||||
{
|
||||
// Redirect to home page if the user is authenticated.
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
#endif
|
||||
#if (IndividualAuth)
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||
private readonly IEmailSender _emailSender;
|
||||
private readonly ISmsSender _smsSender;
|
||||
private readonly ILogger _logger;
|
||||
private readonly string _externalCookieScheme;
|
||||
|
||||
public AccountController(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
IOptions<IdentityCookieOptions> identityCookieOptions,
|
||||
IEmailSender emailSender,
|
||||
ISmsSender smsSender,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_signInManager = signInManager;
|
||||
_externalCookieScheme = identityCookieOptions.Value.ExternalCookieAuthenticationScheme;
|
||||
_emailSender = emailSender;
|
||||
_smsSender = smsSender;
|
||||
_logger = loggerFactory.CreateLogger<AccountController>();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/Login
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Login(string returnUrl = null)
|
||||
{
|
||||
// Clear the existing external cookie to ensure a clean login process
|
||||
await HttpContext.Authentication.SignOutAsync(_externalCookieScheme);
|
||||
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/Login
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Login(LoginViewModel model, string returnUrl = null)
|
||||
{
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// This doesn't count login failures towards account lockout
|
||||
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
|
||||
var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
_logger.LogInformation(1, "User logged in.");
|
||||
return RedirectToLocal(returnUrl);
|
||||
}
|
||||
if (result.RequiresTwoFactor)
|
||||
{
|
||||
return RedirectToAction(nameof(SendCode), new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
|
||||
}
|
||||
if (result.IsLockedOut)
|
||||
{
|
||||
_logger.LogWarning(2, "User account locked out.");
|
||||
return View("Lockout");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
// If we got this far, something failed, redisplay form
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/Register
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public IActionResult Register(string returnUrl = null)
|
||||
{
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/Register
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null)
|
||||
{
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
|
||||
var result = await _userManager.CreateAsync(user, model.Password);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=532713
|
||||
// Send an email with this link
|
||||
//var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
//var callbackUrl = Url.Action(nameof(ConfirmEmail), "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
//await _emailSender.SendEmailAsync(model.Email, "Confirm your account",
|
||||
// $"Please confirm your account by clicking this link: <a href='{callbackUrl}'>link</a>");
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(3, "User created a new account with password.");
|
||||
return RedirectToLocal(returnUrl);
|
||||
}
|
||||
AddErrors(result);
|
||||
}
|
||||
|
||||
// If we got this far, something failed, redisplay form
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/Logout
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Logout()
|
||||
{
|
||||
await _signInManager.SignOutAsync();
|
||||
_logger.LogInformation(4, "User logged out.");
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/ExternalLogin
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult ExternalLogin(string provider, string returnUrl = null)
|
||||
{
|
||||
// Request a redirect to the external login provider.
|
||||
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Account", new { ReturnUrl = returnUrl });
|
||||
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
|
||||
return Challenge(properties, provider);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/ExternalLoginCallback
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
|
||||
{
|
||||
if (remoteError != null)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, $"Error from external provider: {remoteError}");
|
||||
return View(nameof(Login));
|
||||
}
|
||||
var info = await _signInManager.GetExternalLoginInfoAsync();
|
||||
if (info == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Login));
|
||||
}
|
||||
|
||||
// Sign in the user with this external login provider if the user already has a login.
|
||||
var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
_logger.LogInformation(5, "User logged in with {Name} provider.", info.LoginProvider);
|
||||
return RedirectToLocal(returnUrl);
|
||||
}
|
||||
if (result.RequiresTwoFactor)
|
||||
{
|
||||
return RedirectToAction(nameof(SendCode), new { ReturnUrl = returnUrl });
|
||||
}
|
||||
if (result.IsLockedOut)
|
||||
{
|
||||
return View("Lockout");
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the user does not have an account, then ask the user to create an account.
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
ViewData["LoginProvider"] = info.LoginProvider;
|
||||
var email = info.Principal.FindFirstValue(ClaimTypes.Email);
|
||||
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/ExternalLoginConfirmation
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Get the information about the user from the external login provider
|
||||
var info = await _signInManager.GetExternalLoginInfoAsync();
|
||||
if (info == null)
|
||||
{
|
||||
return View("ExternalLoginFailure");
|
||||
}
|
||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
|
||||
var result = await _userManager.CreateAsync(user);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
result = await _userManager.AddLoginAsync(user, info);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(6, "User created an account using {Name} provider.", info.LoginProvider);
|
||||
return RedirectToLocal(returnUrl);
|
||||
}
|
||||
}
|
||||
AddErrors(result);
|
||||
}
|
||||
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Account/ConfirmEmail
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ConfirmEmail(string userId, string code)
|
||||
{
|
||||
if (userId == null || code == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var user = await _userManager.FindByIdAsync(userId);
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var result = await _userManager.ConfirmEmailAsync(user, code);
|
||||
return View(result.Succeeded ? "ConfirmEmail" : "Error");
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/ForgotPassword
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public IActionResult ForgotPassword()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/ForgotPassword
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> ForgotPassword(ForgotPasswordViewModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = await _userManager.FindByEmailAsync(model.Email);
|
||||
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
|
||||
{
|
||||
// Don't reveal that the user does not exist or is not confirmed
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
|
||||
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=532713
|
||||
// Send an email with this link
|
||||
//var code = await _userManager.GeneratePasswordResetTokenAsync(user);
|
||||
//var callbackUrl = Url.Action(nameof(ResetPassword), "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
//await _emailSender.SendEmailAsync(model.Email, "Reset Password",
|
||||
// $"Please reset your password by clicking here: <a href='{callbackUrl}'>link</a>");
|
||||
//return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
|
||||
// If we got this far, something failed, redisplay form
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/ForgotPasswordConfirmation
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public IActionResult ForgotPasswordConfirmation()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/ResetPassword
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public IActionResult ResetPassword(string code = null)
|
||||
{
|
||||
return code == null ? View("Error") : View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/ResetPassword
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
var user = await _userManager.FindByEmailAsync(model.Email);
|
||||
if (user == null)
|
||||
{
|
||||
// Don't reveal that the user does not exist
|
||||
return RedirectToAction(nameof(AccountController.ResetPasswordConfirmation), "Account");
|
||||
}
|
||||
var result = await _userManager.ResetPasswordAsync(user, model.Code, model.Password);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
return RedirectToAction(nameof(AccountController.ResetPasswordConfirmation), "Account");
|
||||
}
|
||||
AddErrors(result);
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/ResetPasswordConfirmation
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public IActionResult ResetPasswordConfirmation()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/SendCode
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult> SendCode(string returnUrl = null, bool rememberMe = false)
|
||||
{
|
||||
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var userFactors = await _userManager.GetValidTwoFactorProvidersAsync(user);
|
||||
var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList();
|
||||
return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/SendCode
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> SendCode(SendCodeViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
|
||||
// Generate the token and send it
|
||||
var code = await _userManager.GenerateTwoFactorTokenAsync(user, model.SelectedProvider);
|
||||
if (string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
|
||||
var message = "Your security code is: " + code;
|
||||
if (model.SelectedProvider == "Email")
|
||||
{
|
||||
await _emailSender.SendEmailAsync(await _userManager.GetEmailAsync(user), "Security Code", message);
|
||||
}
|
||||
else if (model.SelectedProvider == "Phone")
|
||||
{
|
||||
await _smsSender.SendSmsAsync(await _userManager.GetPhoneNumberAsync(user), message);
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(VerifyCode), new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/VerifyCode
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> VerifyCode(string provider, bool rememberMe, string returnUrl = null)
|
||||
{
|
||||
// Require that the user has already logged in via username/password or external login
|
||||
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe });
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/VerifyCode
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> VerifyCode(VerifyCodeViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// The following code protects for brute force attacks against the two factor codes.
|
||||
// If a user enters incorrect codes for a specified amount of time then the user account
|
||||
// will be locked out for a specified amount of time.
|
||||
var result = await _signInManager.TwoFactorSignInAsync(model.Provider, model.Code, model.RememberMe, model.RememberBrowser);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
return RedirectToLocal(model.ReturnUrl);
|
||||
}
|
||||
if (result.IsLockedOut)
|
||||
{
|
||||
_logger.LogWarning(7, "User account locked out.");
|
||||
return View("Lockout");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, "Invalid code.");
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// GET: /Account/AccessDenied
|
||||
[HttpGet]
|
||||
public IActionResult AccessDenied()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#if (IndividualAuth)
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void AddErrors(IdentityResult result)
|
||||
{
|
||||
foreach (var error in result.Errors)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, error.Description);
|
||||
}
|
||||
}
|
||||
|
||||
private IActionResult RedirectToLocal(string returnUrl)
|
||||
{
|
||||
if (Url.IsLocalUrl(returnUrl))
|
||||
{
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
#if (OrganizationalAuth)
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.WebApplication1.Controllers
|
||||
{
|
||||
#if (OrganizationalAuth)
|
||||
[Authorize]
|
||||
#endif
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult About()
|
||||
{
|
||||
ViewData["Message"] = "Your application description page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Contact()
|
||||
{
|
||||
ViewData["Message"] = "Your contact page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
#if (OrganizationalAuth)
|
||||
[AllowAnonymous]
|
||||
#endif
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,373 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Company.WebApplication1.Models;
|
||||
using Company.WebApplication1.Models.ManageViewModels;
|
||||
using Company.WebApplication1.Services;
|
||||
|
||||
namespace Company.WebApplication1.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class ManageController : Controller
|
||||
{
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||
private readonly string _externalCookieScheme;
|
||||
private readonly IEmailSender _emailSender;
|
||||
private readonly ISmsSender _smsSender;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ManageController(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
IOptions<IdentityCookieOptions> identityCookieOptions,
|
||||
IEmailSender emailSender,
|
||||
ISmsSender smsSender,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_signInManager = signInManager;
|
||||
_externalCookieScheme = identityCookieOptions.Value.ExternalCookieAuthenticationScheme;
|
||||
_emailSender = emailSender;
|
||||
_smsSender = smsSender;
|
||||
_logger = loggerFactory.CreateLogger<ManageController>();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/Index
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Index(ManageMessageId? message = null)
|
||||
{
|
||||
ViewData["StatusMessage"] =
|
||||
message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
|
||||
: message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
|
||||
: message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
|
||||
: message == ManageMessageId.Error ? "An error has occurred."
|
||||
: message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
|
||||
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
|
||||
: "";
|
||||
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var model = new IndexViewModel
|
||||
{
|
||||
HasPassword = await _userManager.HasPasswordAsync(user),
|
||||
PhoneNumber = await _userManager.GetPhoneNumberAsync(user),
|
||||
TwoFactor = await _userManager.GetTwoFactorEnabledAsync(user),
|
||||
Logins = await _userManager.GetLoginsAsync(user),
|
||||
BrowserRemembered = await _signInManager.IsTwoFactorClientRememberedAsync(user)
|
||||
};
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/RemoveLogin
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> RemoveLogin(RemoveLoginViewModel account)
|
||||
{
|
||||
ManageMessageId? message = ManageMessageId.Error;
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
var result = await _userManager.RemoveLoginAsync(user, account.LoginProvider, account.ProviderKey);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
message = ManageMessageId.RemoveLoginSuccess;
|
||||
}
|
||||
}
|
||||
return RedirectToAction(nameof(ManageLogins), new { Message = message });
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/AddPhoneNumber
|
||||
public IActionResult AddPhoneNumber()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/AddPhoneNumber
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
// Generate the token and send it
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
|
||||
await _smsSender.SendSmsAsync(model.PhoneNumber, "Your security code is: " + code);
|
||||
return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/EnableTwoFactorAuthentication
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> EnableTwoFactorAuthentication()
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
await _userManager.SetTwoFactorEnabledAsync(user, true);
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(1, "User enabled two-factor authentication.");
|
||||
}
|
||||
return RedirectToAction(nameof(Index), "Manage");
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/DisableTwoFactorAuthentication
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DisableTwoFactorAuthentication()
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
await _userManager.SetTwoFactorEnabledAsync(user, false);
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(2, "User disabled two-factor authentication.");
|
||||
}
|
||||
return RedirectToAction(nameof(Index), "Manage");
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/VerifyPhoneNumber
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> VerifyPhoneNumber(string phoneNumber)
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, phoneNumber);
|
||||
// Send an SMS to verify the phone number
|
||||
return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/VerifyPhoneNumber
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
var result = await _userManager.ChangePhoneNumberAsync(user, model.PhoneNumber, model.Code);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.AddPhoneSuccess });
|
||||
}
|
||||
}
|
||||
// If we got this far, something failed, redisplay the form
|
||||
ModelState.AddModelError(string.Empty, "Failed to verify phone number");
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/RemovePhoneNumber
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> RemovePhoneNumber()
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
var result = await _userManager.SetPhoneNumberAsync(user, null);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.RemovePhoneSuccess });
|
||||
}
|
||||
}
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/ChangePassword
|
||||
[HttpGet]
|
||||
public IActionResult ChangePassword()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/ChangePassword
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> ChangePassword(ChangePasswordViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
var result = await _userManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(3, "User changed their password successfully.");
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.ChangePasswordSuccess });
|
||||
}
|
||||
AddErrors(result);
|
||||
return View(model);
|
||||
}
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/SetPassword
|
||||
[HttpGet]
|
||||
public IActionResult SetPassword()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/SetPassword
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> SetPassword(SetPasswordViewModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user != null)
|
||||
{
|
||||
var result = await _userManager.AddPasswordAsync(user, model.NewPassword);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.SetPasswordSuccess });
|
||||
}
|
||||
AddErrors(result);
|
||||
return View(model);
|
||||
}
|
||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
||||
}
|
||||
|
||||
//GET: /Manage/ManageLogins
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ManageLogins(ManageMessageId? message = null)
|
||||
{
|
||||
ViewData["StatusMessage"] =
|
||||
message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
|
||||
: message == ManageMessageId.AddLoginSuccess ? "The external login was added."
|
||||
: message == ManageMessageId.Error ? "An error has occurred."
|
||||
: "";
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var userLogins = await _userManager.GetLoginsAsync(user);
|
||||
var otherLogins = _signInManager.GetExternalAuthenticationSchemes().Where(auth => userLogins.All(ul => auth.AuthenticationScheme != ul.LoginProvider)).ToList();
|
||||
ViewData["ShowRemoveButton"] = user.PasswordHash != null || userLogins.Count > 1;
|
||||
return View(new ManageLoginsViewModel
|
||||
{
|
||||
CurrentLogins = userLogins,
|
||||
OtherLogins = otherLogins
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Manage/LinkLogin
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> LinkLogin(string provider)
|
||||
{
|
||||
// Clear the existing external cookie to ensure a clean login process
|
||||
await HttpContext.Authentication.SignOutAsync(_externalCookieScheme);
|
||||
|
||||
// Request a redirect to the external login provider to link a login for the current user
|
||||
var redirectUrl = Url.Action(nameof(LinkLoginCallback), "Manage");
|
||||
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User));
|
||||
return Challenge(properties, provider);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Manage/LinkLoginCallback
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> LinkLoginCallback()
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null)
|
||||
{
|
||||
return View("Error");
|
||||
}
|
||||
var info = await _signInManager.GetExternalLoginInfoAsync(await _userManager.GetUserIdAsync(user));
|
||||
if (info == null)
|
||||
{
|
||||
return RedirectToAction(nameof(ManageLogins), new { Message = ManageMessageId.Error });
|
||||
}
|
||||
var result = await _userManager.AddLoginAsync(user, info);
|
||||
var message = ManageMessageId.Error;
|
||||
if (result.Succeeded)
|
||||
{
|
||||
message = ManageMessageId.AddLoginSuccess;
|
||||
// Clear the existing external cookie to ensure a clean login process
|
||||
await HttpContext.Authentication.SignOutAsync(_externalCookieScheme);
|
||||
}
|
||||
return RedirectToAction(nameof(ManageLogins), new { Message = message });
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void AddErrors(IdentityResult result)
|
||||
{
|
||||
foreach (var error in result.Errors)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, error.Description);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ManageMessageId
|
||||
{
|
||||
AddPhoneSuccess,
|
||||
AddLoginSuccess,
|
||||
ChangePasswordSuccess,
|
||||
SetTwoFactorSuccess,
|
||||
SetPasswordSuccess,
|
||||
RemoveLoginSuccess,
|
||||
RemovePhoneSuccess,
|
||||
Error
|
||||
}
|
||||
|
||||
private Task<ApplicationUser> GetCurrentUserAsync()
|
||||
{
|
||||
return _userManager.GetUserAsync(HttpContext.User);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Company.WebApplication1.Models;
|
||||
|
||||
namespace Company.WebApplication1.Data
|
||||
{
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
// Customize the ASP.NET Identity model and override the defaults if needed.
|
||||
// For example, you can rename the ASP.NET Identity table names and more.
|
||||
// Add your customizations after calling base.OnModelCreating(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
using System;
|
||||
#if (UseLocalDB)
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Company.WebApplication1.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("00000000000000_CreateIdentitySchema")]
|
||||
partial class CreateIdentitySchema
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("ProductVersion", "1.0.0-rc3")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
#else
|
||||
.HasAnnotation("ProductVersion", "1.0.2");
|
||||
#endif
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken();
|
||||
|
||||
b.Property<string>("Name")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.HasName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("ClaimType");
|
||||
|
||||
b.Property<string>("ClaimValue");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired();
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("ClaimType");
|
||||
|
||||
b.Property<string>("ClaimValue");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired();
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider");
|
||||
|
||||
b.Property<string>("ProviderKey");
|
||||
|
||||
b.Property<string>("ProviderDisplayName");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired();
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId");
|
||||
|
||||
b.Property<string>("RoleId");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId");
|
||||
|
||||
b.Property<string>("LoginProvider");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<string>("Id");
|
||||
|
||||
b.Property<int>("AccessFailedCount");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken();
|
||||
|
||||
b.Property<string>("Email")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.Property<bool>("EmailConfirmed");
|
||||
|
||||
b.Property<bool>("LockoutEnabled");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.Property<string>("PasswordHash");
|
||||
|
||||
b.Property<string>("PhoneNumber");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed");
|
||||
|
||||
b.Property<string>("SecurityStamp");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
#if (UseLocalDB)
|
||||
.HasAnnotation("MaxLength", 256);
|
||||
#else
|
||||
.HasMaxLength(256);
|
||||
#endif
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
|
||||
.WithMany("Claims")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Company.WebApplication1.Models.ApplicationUser")
|
||||
.WithMany("Claims")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Company.WebApplication1.Models.ApplicationUser")
|
||||
.WithMany("Logins")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Company.WebApplication1.Models.ApplicationUser")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class ExternalLoginConfirmationViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class ForgotPasswordViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class LoginViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataType(DataType.Password)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Display(Name = "Remember me?")]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class RegisterViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class ResetPasswordViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class SendCodeViewModel
|
||||
{
|
||||
public string SelectedProvider { get; set; }
|
||||
|
||||
public ICollection<SelectListItem> Providers { get; set; }
|
||||
|
||||
public string ReturnUrl { get; set; }
|
||||
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.AccountViewModels
|
||||
{
|
||||
public class VerifyCodeViewModel
|
||||
{
|
||||
[Required]
|
||||
public string Provider { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Code { get; set; }
|
||||
|
||||
public string ReturnUrl { get; set; }
|
||||
|
||||
[Display(Name = "Remember this browser?")]
|
||||
public bool RememberBrowser { get; set; }
|
||||
|
||||
[Display(Name = "Remember me?")]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
|
||||
namespace Company.WebApplication1.Models
|
||||
{
|
||||
// Add profile data for application users by adding properties to the ApplicationUser class
|
||||
public class ApplicationUser : IdentityUser
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class AddPhoneNumberViewModel
|
||||
{
|
||||
[Required]
|
||||
[Phone]
|
||||
[Display(Name = "Phone number")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class ChangePasswordViewModel
|
||||
{
|
||||
[Required]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Current password")]
|
||||
public string OldPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "New password")]
|
||||
public string NewPassword { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm new password")]
|
||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class ConfigureTwoFactorViewModel
|
||||
{
|
||||
public string SelectedProvider { get; set; }
|
||||
|
||||
public ICollection<SelectListItem> Providers { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class FactorViewModel
|
||||
{
|
||||
public string Purpose { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class IndexViewModel
|
||||
{
|
||||
public bool HasPassword { get; set; }
|
||||
|
||||
public IList<UserLoginInfo> Logins { get; set; }
|
||||
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public bool TwoFactor { get; set; }
|
||||
|
||||
public bool BrowserRemembered { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http.Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class ManageLoginsViewModel
|
||||
{
|
||||
public IList<UserLoginInfo> CurrentLogins { get; set; }
|
||||
|
||||
public IList<AuthenticationDescription> OtherLogins { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class RemoveLoginViewModel
|
||||
{
|
||||
public string LoginProvider { get; set; }
|
||||
public string ProviderKey { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class SetPasswordViewModel
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "New password")]
|
||||
public string NewPassword { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm new password")]
|
||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Models.ManageViewModels
|
||||
{
|
||||
public class VerifyPhoneNumberViewModel
|
||||
{
|
||||
[Required]
|
||||
public string Code { get; set; }
|
||||
|
||||
[Required]
|
||||
[Phone]
|
||||
[Display(Name = "Phone number")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
#if (IncludeApplicationInsights)
|
||||
.UseApplicationInsights()
|
||||
#endif
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
//#if (WindowsAuth)
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
//#else
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
//#endif
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:55556/",
|
||||
//#if (RequiresHttps)
|
||||
"sslPort": 43434
|
||||
//#else
|
||||
"sslPort": 0
|
||||
//#endif
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
//#if (RequiresHttps)
|
||||
"launchUrl": "https://localhost:43434/",
|
||||
//#endif
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
//#if (!WindowsAuth)
|
||||
},
|
||||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5001/"
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Services
|
||||
{
|
||||
public interface ISmsSender
|
||||
{
|
||||
Task SendSmsAsync(string number, string message);
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.WebApplication1.Services
|
||||
{
|
||||
// This class is used by the application to send Email and SMS
|
||||
// when you turn on two-factor authentication in ASP.NET Identity.
|
||||
// For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713
|
||||
public class AuthMessageSender : IEmailSender, ISmsSender
|
||||
{
|
||||
public Task SendEmailAsync(string email, string subject, string message)
|
||||
{
|
||||
// Plug in your email service here to send an email.
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task SendSmsAsync(string number, string message)
|
||||
{
|
||||
// Plug in your SMS service here to send a text message.
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
#if (OrganizationalAuth)
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
#endif
|
||||
#if (MultiOrgAuth)
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if (IndividualAuth)
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
#endif
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
#if (OrganizationalAuth && OrgReadAccess)
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
#endif
|
||||
#if (MultiOrgAuth)
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
#endif
|
||||
#if (IndividualAuth)
|
||||
using Company.WebApplication1.Data;
|
||||
using Company.WebApplication1.Models;
|
||||
using Company.WebApplication1.Services;
|
||||
#endif
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
#if (IndividualAuth || OrganizationalAuth)
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
// For more details on using the user secret store see https://go.microsoft.com/fwlink/?LinkID=532709
|
||||
builder.AddUserSecrets<Startup>();
|
||||
}
|
||||
#else
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||
.AddEnvironmentVariables();
|
||||
#endif
|
||||
#if (IndividualAuth || MultiOrgAuth || SingleOrgAuth)
|
||||
|
||||
builder.AddEnvironmentVariables();
|
||||
#endif
|
||||
Configuration = builder.Build();
|
||||
}
|
||||
|
||||
public IConfigurationRoot Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Add framework services.
|
||||
#if (IndividualAuth)
|
||||
services.AddDbContext<ApplicationDbContext>(options =>
|
||||
#if (UseLocalDB)
|
||||
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
|
||||
#else
|
||||
options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
|
||||
#endif
|
||||
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
#endif
|
||||
services.AddMvc();
|
||||
#if (IndividualAuth)
|
||||
|
||||
// Add application services.
|
||||
services.AddTransient<IEmailSender, AuthMessageSender>();
|
||||
services.AddTransient<ISmsSender, AuthMessageSender>();
|
||||
#elseif (OrganizationalAuth)
|
||||
|
||||
services.AddAuthentication(
|
||||
SharedOptions => SharedOptions.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
#endif
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
#if (IndividualAuth)
|
||||
app.UseDatabaseErrorPage();
|
||||
#endif
|
||||
#if (UseBrowserLink)
|
||||
app.UseBrowserLink();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
#if (IndividualAuth)
|
||||
app.UseIdentity();
|
||||
|
||||
// Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715
|
||||
|
||||
#elseif (OrganizationalAuth)
|
||||
app.UseCookieAuthentication();
|
||||
|
||||
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
|
||||
{
|
||||
ClientId = Configuration["Authentication:AzureAd:ClientId"],
|
||||
#if (OrgReadAccess)
|
||||
ClientSecret = Configuration["Authentication:AzureAd:ClientSecret"],
|
||||
#endif
|
||||
#if (MultiOrgAuth)
|
||||
Authority = Configuration["Authentication:AzureAd:AADInstance"] + "Common",
|
||||
#elseif (SingleOrgAuth)
|
||||
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
|
||||
#endif
|
||||
#endif
|
||||
#if (MultiOrgAuth)
|
||||
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
|
||||
#if (OrgReadAccess)
|
||||
ResponseType = OpenIdConnectResponseType.CodeIdToken,
|
||||
#endif
|
||||
|
||||
TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
// Instead of using the default validation (validating against a single issuer value, as we do in line of business apps),
|
||||
// we inject our own multitenant validation logic
|
||||
ValidateIssuer = false,
|
||||
|
||||
// If the app is meant to be accessed by entire organizations, add your issuer validation logic here.
|
||||
//IssuerValidator = (issuer, securityToken, validationParameters) => {
|
||||
// if (myIssuerValidationLogic(issuer)) return issuer;
|
||||
//}
|
||||
},
|
||||
Events = new OpenIdConnectEvents
|
||||
{
|
||||
OnTicketReceived = (context) =>
|
||||
{
|
||||
// If your authentication logic is based on users then add your logic here
|
||||
return Task.FromResult(0);
|
||||
},
|
||||
OnAuthenticationFailed = (context) =>
|
||||
{
|
||||
context.Response.Redirect("/Home/Error");
|
||||
context.HandleResponse(); // Suppress the exception
|
||||
return Task.FromResult(0);
|
||||
},
|
||||
// If your application needs to do authenticate single users, add your user validation below.
|
||||
//OnTokenValidated = (context) =>
|
||||
//{
|
||||
// return myUserValidationLogic(context.Ticket.Principal);
|
||||
//}
|
||||
}
|
||||
#elseif (SingleOrgAuth)
|
||||
#if (OrgReadAccess)
|
||||
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
|
||||
ResponseType = OpenIdConnectResponseType.CodeIdToken
|
||||
#else
|
||||
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"]
|
||||
#endif
|
||||
#endif
|
||||
#if (OrganizationalAuth)
|
||||
});
|
||||
|
||||
#endif
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Access Denied";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1 class="text-danger">Access Denied.</h1>
|
||||
<p class="text-danger">You do not have access to this resource.</p>
|
||||
</header>
|
|
@ -1,10 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Confirm Email";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<div>
|
||||
<p>
|
||||
Thank you for confirming your email. Please <a asp-controller="Account" asp-action="Login">Click here to Log in</a>.
|
||||
</p>
|
||||
</div>
|
|
@ -1,35 +0,0 @@
|
|||
@model ExternalLoginConfirmationViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<h3>Associate your @ViewData["LoginProvider"] account.</h3>
|
||||
|
||||
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<h4>Association Form</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
|
||||
<p class="text-info">
|
||||
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>.
|
||||
Please enter an email address for this site below and click the Register button to finish
|
||||
logging in.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Login Failure";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<p class="text-danger">Unsuccessful login with service.</p>
|
||||
</header>
|
|
@ -1,31 +0,0 @@
|
|||
@model ForgotPasswordViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Forgot your password?";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<p>
|
||||
For more information on how to enable password reset, please see this <a href="https://go.microsoft.com/fwlink/?LinkID=532713">article</a>.
|
||||
</p>
|
||||
|
||||
@*<form asp-controller="Account" asp-action="ForgotPassword" method="post" class="form-horizontal">
|
||||
<h4>Enter your email.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>*@
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Forgot Password Confirmation";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<p>
|
||||
Please check your email to reset your password.
|
||||
</p>
|
|
@ -1,8 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Locked out";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1 class="text-danger">Locked out.</h1>
|
||||
<p class="text-danger">This account has been locked out, please try again later.</p>
|
||||
</header>
|
|
@ -1,92 +0,0 @@
|
|||
@using System.Collections.Generic
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Authentication
|
||||
@model LoginViewModel
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Log in";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<section>
|
||||
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<h4>Use a local account to log in.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<div class="checkbox">
|
||||
<label asp-for="RememberMe">
|
||||
<input asp-for="RememberMe" />
|
||||
@Html.DisplayNameFor(m => m.RememberMe)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Log in</button>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<a asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]">Register as a new user?</a>
|
||||
</p>
|
||||
<p>
|
||||
<a asp-action="ForgotPassword">Forgot your password?</a>
|
||||
</p>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<section>
|
||||
<h4>Use another service to log in.</h4>
|
||||
<hr />
|
||||
@{
|
||||
var loginProviders = SignInManager.GetExternalAuthenticationSchemes().ToList();
|
||||
if (loginProviders.Count == 0)
|
||||
{
|
||||
<div>
|
||||
<p>
|
||||
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
|
||||
for details on setting up this ASP.NET application to support logging in via external services.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form asp-controller="Account" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<div>
|
||||
<p>
|
||||
@foreach (var provider in loginProviders)
|
||||
{
|
||||
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
@model RegisterViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<h4>Create a new account.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
@model ResetPasswordViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Reset password";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Account" asp-action="ResetPassword" method="post" class="form-horizontal">
|
||||
<h4>Reset your password.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<input asp-for="Code" type="hidden" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Reset password confirmation";
|
||||
}
|
||||
|
||||
<h1>@ViewData["Title"].</h1>
|
||||
<p>
|
||||
Your password has been reset. Please <a asp-controller="Account" asp-action="Login">Click here to log in</a>.
|
||||
</p>
|
|
@ -1,21 +0,0 @@
|
|||
@model SendCodeViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Send Verification Code";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Account" asp-action="SendCode" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
<input asp-for="RememberMe" type="hidden" />
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
Select Two-Factor Authentication Provider:
|
||||
<select asp-for="SelectedProvider" asp-items="Model.Providers"></select>
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Sign Out";
|
||||
}
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<p class="text-success">You have successfully signed out.</p>
|
|
@ -1,38 +0,0 @@
|
|||
@model VerifyCodeViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Verify";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Account" asp-action="VerifyCode" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<input asp-for="Provider" type="hidden" />
|
||||
<input asp-for="RememberMe" type="hidden" />
|
||||
<h4>@ViewData["Status"]</h4>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<label asp-for="Code" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Code" class="form-control" />
|
||||
<span asp-validation-for="Code" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<div class="checkbox">
|
||||
<input asp-for="RememberBrowser" />
|
||||
<label asp-for="RememberBrowser"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
@model AddPhoneNumberViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Add Phone Number";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<form asp-controller="Manage" asp-action="AddPhoneNumber" method="post" class="form-horizontal">
|
||||
<h4>Add a phone number.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="PhoneNumber" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="PhoneNumber" class="form-control" />
|
||||
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Send verification code</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
@model ChangePasswordViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Change Password";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Manage" asp-action="ChangePassword" method="post" class="form-horizontal">
|
||||
<h4>Change Password Form</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="OldPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="OldPassword" class="form-control" />
|
||||
<span asp-validation-for="OldPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="NewPassword" class="form-control" />
|
||||
<span asp-validation-for="NewPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Change password</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
@model IndexViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Manage your account";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<p class="text-success">@ViewData["StatusMessage"]</p>
|
||||
|
||||
<div>
|
||||
<h4>Change your account settings</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Password:</dt>
|
||||
<dd>
|
||||
@if (Model.HasPassword)
|
||||
{
|
||||
<a asp-controller="Manage" asp-action="ChangePassword" class="btn-bracketed">Change</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a asp-controller="Manage" asp-action="SetPassword" class="btn-bracketed">Create</a>
|
||||
}
|
||||
</dd>
|
||||
<dt>External Logins:</dt>
|
||||
<dd>
|
||||
|
||||
@Model.Logins.Count <a asp-controller="Manage" asp-action="ManageLogins" class="btn-bracketed">Manage</a>
|
||||
</dd>
|
||||
<dt>Phone Number:</dt>
|
||||
<dd>
|
||||
<p>
|
||||
Phone Numbers can be used as a second factor of verification in two-factor authentication.
|
||||
See <a href="https://go.microsoft.com/fwlink/?LinkID=532713">this article</a>
|
||||
for details on setting up this ASP.NET application to support two-factor authentication using SMS.
|
||||
</p>
|
||||
@*@(Model.PhoneNumber ?? "None")
|
||||
@if (Model.PhoneNumber != null)
|
||||
{
|
||||
<br />
|
||||
<a asp-controller="Manage" asp-action="AddPhoneNumber" class="btn-bracketed">Change</a>
|
||||
<form asp-controller="Manage" asp-action="RemovePhoneNumber" method="post">
|
||||
[<button type="submit" class="btn-link">Remove</button>]
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a asp-controller="Manage" asp-action="AddPhoneNumber" class="btn-bracketed">Add</a>
|
||||
}*@
|
||||
</dd>
|
||||
|
||||
<dt>Two-Factor Authentication:</dt>
|
||||
<dd>
|
||||
<p>
|
||||
There are no two-factor authentication providers configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532713">this article</a>
|
||||
for setting up this application to support two-factor authentication.
|
||||
</p>
|
||||
@*@if (Model.TwoFactor)
|
||||
{
|
||||
<form asp-controller="Manage" asp-action="DisableTwoFactorAuthentication" method="post" class="form-horizontal">
|
||||
Enabled <button type="submit" class="btn-link btn-bracketed">Disable</button>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form asp-controller="Manage" asp-action="EnableTwoFactorAuthentication" method="post" class="form-horizontal">
|
||||
<button type="submit" class="btn-link btn-bracketed">Enable</button> Disabled
|
||||
</form>
|
||||
}*@
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
|
@ -1,54 +0,0 @@
|
|||
@model ManageLoginsViewModel
|
||||
@using Microsoft.AspNetCore.Http.Authentication
|
||||
@{
|
||||
ViewData["Title"] = "Manage your external logins";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<p class="text-success">@ViewData["StatusMessage"]</p>
|
||||
@if (Model.CurrentLogins.Count > 0)
|
||||
{
|
||||
<h4>Registered Logins</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@for (var index = 0; index < Model.CurrentLogins.Count; index++)
|
||||
{
|
||||
<tr>
|
||||
<td>@Model.CurrentLogins[index].LoginProvider</td>
|
||||
<td>
|
||||
@if ((bool)ViewData["ShowRemoveButton"])
|
||||
{
|
||||
<form asp-controller="Manage" asp-action="RemoveLogin" method="post" class="form-horizontal">
|
||||
<div>
|
||||
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" />
|
||||
<input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" />
|
||||
<input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" />
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
@:
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@if (Model.OtherLogins.Count > 0)
|
||||
{
|
||||
<h4>Add another service to log in.</h4>
|
||||
<hr />
|
||||
<form asp-controller="Manage" asp-action="LinkLogin" method="post" class="form-horizontal">
|
||||
<div id="socialLoginList">
|
||||
<p>
|
||||
@foreach (var provider in Model.OtherLogins)
|
||||
{
|
||||
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
@model SetPasswordViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Set Password";
|
||||
}
|
||||
|
||||
<p class="text-info">
|
||||
You do not have a local username/password for this site. Add a local
|
||||
account so you can log in without an external login.
|
||||
</p>
|
||||
|
||||
<form asp-controller="Manage" asp-action="SetPassword" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<h4>Set your password</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="NewPassword" class="form-control" />
|
||||
<span asp-validation-for="NewPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Set password</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
@model VerifyPhoneNumberViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Verify Phone Number";
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
<form asp-controller="Manage" asp-action="VerifyPhoneNumber" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||
<input asp-for="PhoneNumber" type="hidden" />
|
||||
<h4>Add a phone number.</h4>
|
||||
<h5>@ViewData["Status"]</h5>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Code" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Code" class="form-control" />
|
||||
<span asp-validation-for="Code" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Development environment should not be enabled in deployed applications</strong>, 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 <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||
</p>
|
|
@ -1,82 +0,0 @@
|
|||
@*#if (IncludeApplicationInsights)
|
||||
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
|
||||
#endif*@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Company.WebApplication1</title>
|
||||
|
||||
<environment names="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
@*#if (IncludeApplicationInsights)
|
||||
@Html.Raw(JavaScriptSnippet.FullScript)
|
||||
#endif*@
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Company.WebApplication1</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||
</ul>
|
||||
@*#if (IndividualAuth || OrganizationalAuth)
|
||||
@await Html.PartialAsync("_LoginPartial")
|
||||
#elseif (WindowsAuth)
|
||||
<p class="nav navbar-text navbar-right">Hello, @User.Identity.Name!</p>
|
||||
#endif*@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 1975 - Company.WebApplication1</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||
</script>
|
||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
|
@ -1,47 +0,0 @@
|
|||
@*#if (IndividualAuth) *@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Company.WebApplication1.Models
|
||||
@*#else
|
||||
@using System.Security.Principal
|
||||
#endif *@
|
||||
|
||||
@*#if (IndividualAuth) *@
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@*#endif *@
|
||||
@*#if (IndividualAuth) *@
|
||||
|
||||
@if (SignInManager.IsSignedIn(User))
|
||||
@*#else
|
||||
@if (User.Identity.IsAuthenticated)
|
||||
#endif *@
|
||||
{
|
||||
@*#if (IndividualAuth) *@
|
||||
<form asp-area="" asp-controller="Account" asp-action="Logout" method="post" id="logoutForm" class="navbar-right">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
|
||||
</li>
|
||||
<li>
|
||||
<button type="submit" class="btn btn-link navbar-btn navbar-link">Log out</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
@*#else
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="navbar-text">Hello @User.Identity.Name!</li>
|
||||
<li><a asp-area="" asp-controller="Account" asp-action="SignOut">Sign Out</a></li>
|
||||
</ul>
|
||||
#endif *@
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
@*#if (IndividualAuth) *@
|
||||
<li><a asp-area="" asp-controller="Account" asp-action="Register">Register</a></li>
|
||||
<li><a asp-area="" asp-controller="Account" asp-action="Login">Log in</a></li>
|
||||
@*#else
|
||||
<li><a asp-area="" asp-controller="Account" asp-action="Signin">Sign in</a></li>
|
||||
#endif *@
|
||||
</ul>
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<environment names="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
|
||||
</script>
|
||||
</environment>
|
|
@ -1,8 +0,0 @@
|
|||
@using Company.WebApplication1
|
||||
@*#if (IndividualAuth)
|
||||
@using Company.WebApplication1.Models
|
||||
@using Company.WebApplication1.Models.AccountViewModels
|
||||
@using Company.WebApplication1.Models.ManageViewModels
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
#endif*@
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
////#if (OrganizationalAuth)
|
||||
// "Authentication": {
|
||||
// "AzureAd": {
|
||||
// "AADInstance": "https:////login.microsoftonline.com/",
|
||||
// "CallbackPath": "/signin-oidc",
|
||||
//#if (SingleOrgAuth)
|
||||
// "ClientId": "11111111-1111-1111-11111111111111111",
|
||||
// "Domain": "qualified.domain.name",
|
||||
// "TenantId": "22222222-2222-2222-2222-222222222222"
|
||||
//#else
|
||||
// "ClientId": "11111111-1111-1111-11111111111111111"
|
||||
//#endif
|
||||
// }
|
||||
// },
|
||||
//#endif
|
||||
////#if (IndividualAuth)
|
||||
// "ConnectionStrings": {
|
||||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
//#endif
|
||||
// },
|
||||
//#endif
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Wrapping element */
|
||||
/* Set some basic padding to keep content from hitting the edges */
|
||||
.body-content {
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
/* Carousel */
|
||||
.carousel-caption p {
|
||||
font-size: 20px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/*#if (IndividualAuth)
|
||||
/* buttons and links extension to use brackets: [ click me ] */
|
||||
.btn-bracketed::before {
|
||||
display: inline-block;
|
||||
content: "[";
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.btn-bracketed::after {
|
||||
display: inline-block;
|
||||
content: "]";
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
#endif*/
|
||||
/* Make .svg files in the carousel display properly in older browsers */
|
||||
.carousel-inner .item img[src$=".svg"] {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Hide/rearrange for smaller screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
/* Hide captions */
|
||||
.carousel-caption {
|
||||
display: none;
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
/*#if (IndividualAuth)
|
||||
body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
|
||||
#else
|
||||
body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
|
||||
#endif*/
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"UseBrowserLink": {
|
||||
"longName": "use-browserlink",
|
||||
"shortName": ""
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1"
|
||||
]
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "MVC"],
|
||||
"name": "ASP.NET Core Web App (Model-View-Controller)",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "A project template for creating an ASP.NET Core application with example ASP.NET Core MVC Views and Controllers. This template can also be used for RESTful HTTP services.",
|
||||
"groupIdentity": "Microsoft.Web.Mvc",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.Mvc.FSharp",
|
||||
"shortName": "mvc",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "F#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"symbols":{
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"FrameworkIs1_1": {
|
||||
"type": "computed",
|
||||
"value": "Framework == \"netcoreapp1.1\""
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"UseBrowserLink": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include BrowserLink in the project"
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.fsproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers/*.fs" />
|
||||
<Compile Include="Startup.fs" />
|
||||
<Compile Include="Program.fs" />
|
||||
|
||||
<None Remove="**/*.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Framework)' != 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" Condition="'$(UseBrowserLink)' == 'True'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Framework)' == 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.3" Condition="'$(UseBrowserLink)' == 'True'" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,24 +0,0 @@
|
|||
namespace Company.WebApplication1
|
||||
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.IO
|
||||
open System.Linq
|
||||
open System.Threading.Tasks
|
||||
open Microsoft.AspNetCore.Hosting
|
||||
|
||||
module Program =
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args =
|
||||
let host =
|
||||
WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
.Build()
|
||||
|
||||
host.Run()
|
||||
|
||||
0
|
|
@ -1,55 +0,0 @@
|
|||
namespace Company.WebApplication1
|
||||
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.Linq
|
||||
open System.Threading.Tasks
|
||||
open Microsoft.AspNetCore.Builder
|
||||
open Microsoft.AspNetCore.Hosting
|
||||
open Microsoft.Extensions.Configuration
|
||||
open Microsoft.Extensions.DependencyInjection
|
||||
open Microsoft.Extensions.Logging
|
||||
|
||||
|
||||
type Startup private () =
|
||||
|
||||
new (env: IHostingEnvironment) as this =
|
||||
Startup() then
|
||||
|
||||
let builder =
|
||||
ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional = false, reloadOnChange = true)
|
||||
.AddJsonFile((sprintf "appsettings.%s.json" (env.EnvironmentName)), optional = true)
|
||||
.AddEnvironmentVariables()
|
||||
|
||||
this.Configuration <- builder.Build()
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
member this.ConfigureServices(services: IServiceCollection) =
|
||||
// Add framework services.
|
||||
services.AddMvc() |> ignore
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment, loggerFactory: ILoggerFactory) =
|
||||
|
||||
loggerFactory.AddConsole(this.Configuration.GetSection("Logging")) |> ignore
|
||||
loggerFactory.AddDebug() |> ignore
|
||||
|
||||
if (env.IsDevelopment()) then
|
||||
app.UseDeveloperExceptionPage() |> ignore
|
||||
#if (UseBrowserLink)
|
||||
app.UseBrowserLink() |> ignore
|
||||
#endif
|
||||
else
|
||||
app.UseExceptionHandler("/Home/Error") |> ignore
|
||||
|
||||
app.UseStaticFiles() |> ignore
|
||||
|
||||
app.UseMvc(fun routes ->
|
||||
routes.MapRoute(
|
||||
name = "default",
|
||||
template = "{controller=Home}/{action=Index}/{id?}") |> ignore
|
||||
) |> ignore
|
||||
|
||||
member val Configuration : IConfigurationRoot = null with get, set
|
|
@ -1,7 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "About";
|
||||
}
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<p>Use this area to provide additional information.</p>
|
|
@ -1,17 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Contact";
|
||||
}
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<address>
|
||||
One Microsoft Way<br />
|
||||
Redmond, WA 98052-6399<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
425.555.0100
|
||||
</address>
|
||||
|
||||
<address>
|
||||
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||
</address>
|
|
@ -1,14 +0,0 @@
|
|||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Development environment should not be enabled in deployed applications</strong>, 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 <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||
</p>
|
|
@ -1,71 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Company.WebApplication1</title>
|
||||
|
||||
<environment names="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Company.WebApplication1</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 1975 - Company.WebApplication1</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||
</script>
|
||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
<environment names="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
|
||||
</script>
|
||||
</environment>
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"isHidden": "true"
|
||||
},
|
||||
"AADInstance": {
|
||||
"longName": "aad-instance",
|
||||
"shortName": "s"
|
||||
},
|
||||
"OrgReadAccess": {
|
||||
"longName": "org-read-access",
|
||||
"shortName": "r"
|
||||
},
|
||||
"ClientId": {
|
||||
"longName": "client-id",
|
||||
"shortName": ""
|
||||
},
|
||||
"Audience": {
|
||||
"longName": "audience",
|
||||
"shortName": ""
|
||||
},
|
||||
"Domain": {
|
||||
"longName": "domain",
|
||||
"shortName": ""
|
||||
},
|
||||
"TenantId": {
|
||||
"longName": "tenant-id",
|
||||
"shortName": ""
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"HttpsPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"KestrelPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"isHidden": true
|
||||
},
|
||||
"IncludeLaunchSettings": {
|
||||
"isHidden": true
|
||||
},
|
||||
"UserSecretsId": {
|
||||
"isHidden": true
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1"
|
||||
]
|
||||
}
|
|
@ -1,238 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "WebAPI"],
|
||||
"name": "ASP.NET Core Web API",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "A project template for creating an ASP.NET Core application with an example Controller for a RESTful HTTP service. This template can also be used for ASP.NET Core MVC Views and Controllers.",
|
||||
"groupIdentity": "Microsoft.Web.WebApi",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.WebApi.CSharp",
|
||||
"shortName": "webapi",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"guids": [ "53bc9b9d-9d6a-45d4-8429-2a2761773502" ],
|
||||
"sources": [
|
||||
{
|
||||
"modifiers": [
|
||||
{
|
||||
"condition": "(!IncludeLaunchSettings && !WindowsAuth)",
|
||||
"exclude": [
|
||||
"Properties/launchSettings.json"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"auth": {
|
||||
"type": "parameter",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "None",
|
||||
"description": "No authentication"
|
||||
},
|
||||
{
|
||||
"choice": "SingleOrg",
|
||||
"description": "Organizational authentication for a single tenant"
|
||||
},
|
||||
{
|
||||
"choice": "Windows",
|
||||
"description": "Windows authentication"
|
||||
}
|
||||
],
|
||||
"defaultValue": "None",
|
||||
"description": "The type of authentication to use"
|
||||
},
|
||||
"AADInstance": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"defaultValue": "https://login.microsoftonline.com/",
|
||||
"replaces": "https:////login.microsoftonline.com/",
|
||||
"description": "The Azure Active Directory instance to connect to (use with SingleOrg auth)."
|
||||
},
|
||||
"Audience": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "https:////qualified.domain.name/Company.WebApplication1",
|
||||
"description": "The AppIdUrl for the project (use with SingleOrg auth)."
|
||||
},
|
||||
"ClientId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "11111111-1111-1111-11111111111111111",
|
||||
"description": "The Client ID for this project (use with SingleOrg auth)."
|
||||
},
|
||||
"Domain": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "qualified.domain.name",
|
||||
"description": "The domain owning the directory (use with SingleOrg auth)."
|
||||
},
|
||||
"TenantId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "22222222-2222-2222-2222-222222222222",
|
||||
"description": "The TenantId ID of the directory to connect to (use with SingleOrg auth)."
|
||||
},
|
||||
"OrgReadAccess": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to allow this application read access to the directory (only applies to SingleOrg auth)."
|
||||
},
|
||||
"UserSecretsId": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"replaces": "aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502",
|
||||
"defaultValue": "aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502",
|
||||
"description": "The ID to use for secrets (use with OrgReadAccess or Individual auth)."
|
||||
},
|
||||
"IncludeLaunchSettings": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to include launchSettings.json in the generated template."
|
||||
},
|
||||
"HttpsPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure SSL in launchSettings.json."
|
||||
},
|
||||
"HttpsPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port",
|
||||
"parameters": {
|
||||
"low": 44300,
|
||||
"high": 44399
|
||||
}
|
||||
},
|
||||
"HttpsPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "HttpsPort",
|
||||
"fallbackVariableName": "HttpsPortGenerated"
|
||||
},
|
||||
"replaces": "43434"
|
||||
},
|
||||
"KestrelPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure Kestrel in launchSettings.json."
|
||||
},
|
||||
"KestrelPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"KestrelPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "KestrelPort",
|
||||
"fallbackVariableName": "KestrelPortGenerated"
|
||||
},
|
||||
"replaces": "5000"
|
||||
},
|
||||
"IISExpressPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use to configure IIS Express in launchSettings.json."
|
||||
},
|
||||
"IISExpressPortGenerated": {
|
||||
"type": "generated",
|
||||
"generator": "port"
|
||||
},
|
||||
"IISExpressPortReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "IISExpressPort",
|
||||
"fallbackVariableName": "IISExpressPortGenerated"
|
||||
},
|
||||
"replaces": "55556"
|
||||
},
|
||||
"OrganizationalAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"SingleOrg\")"
|
||||
},
|
||||
"WindowsAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"Windows\")"
|
||||
},
|
||||
"SingleOrgAuth": {
|
||||
"type": "computed",
|
||||
"value": "(auth == \"SingleOrg\")"
|
||||
},
|
||||
"NoAuth": {
|
||||
"type": "computed",
|
||||
"value": "(!SingleOrgAuth && !WindowsAuth)"
|
||||
},
|
||||
"RequiresHttps": {
|
||||
"type": "computed",
|
||||
"value": "(OrganizationalAuth)"
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include Application Insights in the project"
|
||||
},
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.csproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/vs-2017.3.host",
|
||||
"name": {
|
||||
"text": "Web API",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1013"
|
||||
},
|
||||
"description": {
|
||||
"text": "A project template for creating an ASP.NET Core application with an example Controller for a RESTful HTTP service. This template can also be used for ASP.NET Core MVC Views and Controllers.",
|
||||
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
|
||||
"id": "1014"
|
||||
},
|
||||
"order": 200,
|
||||
"icon": "vs-2017.3/WebAPI.png",
|
||||
"learnMoreLink": "https://go.microsoft.com/fwlink/?LinkID=784882",
|
||||
"uiFilters": [ "oneaspnet" ],
|
||||
"supportsDocker": true,
|
||||
"isApi": true,
|
||||
"usesOidc": true,
|
||||
"legacyTemplateIdentity": "Microsoft.NetCore.CSharp.WebAPI",
|
||||
"supportedAuthentications": [
|
||||
{
|
||||
"auth": "None",
|
||||
"authenticationType": "NoAuth"
|
||||
},
|
||||
{
|
||||
"auth": "SingleOrg",
|
||||
"authenticationType": "OrgAuth",
|
||||
"orgAuthenticationOptions": "SSO"
|
||||
},
|
||||
{
|
||||
"auth": "Windows",
|
||||
"authenticationType": "WindowsAuth"
|
||||
}
|
||||
],
|
||||
"ports": [
|
||||
{
|
||||
"name": "IISExpressPort",
|
||||
"useHttps": false
|
||||
},
|
||||
{
|
||||
"name": "KestrelPort",
|
||||
"useHttps": false
|
||||
},
|
||||
{
|
||||
"name": "HttpsPort",
|
||||
"useHttps": true
|
||||
}
|
||||
],
|
||||
"azureReplyUrlPortName": "HttpsPort",
|
||||
"includeLaunchSettings": true
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
|
||||
<UserSecretsId Condition="'$(OrganizationalAuth)' == 'True'">aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502</UserSecretsId>
|
||||
<WebProject_DirectoryAccessLevelKey Condition="'$(OrganizationalAuth)' == 'True' AND '$(OrgReadAccess)' != 'True'">0</WebProject_DirectoryAccessLevelKey>
|
||||
<WebProject_DirectoryAccessLevelKey Condition="'$(OrganizationalAuth)' == 'True' AND '$(OrgReadAccess)' == 'True'">1</WebProject_DirectoryAccessLevelKey>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Framework)' != 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.0.5" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.2" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Framework)' == 'netcoreapp1.1'">
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.3" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.1" Condition="'$(OrganizationalAuth)' == 'True'" />
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,59 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
#if (OrganizationalAuth || WindowsAuth)
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.WebApplication1.Controllers
|
||||
{
|
||||
#if (OrganizationalAuth || WindowsAuth)
|
||||
[Authorize]
|
||||
#endif
|
||||
[Route("api/[controller]")]
|
||||
public class ValuesController : Controller
|
||||
{
|
||||
// GET api/values
|
||||
[HttpGet]
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
[HttpGet("{id}")]
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/values
|
||||
[HttpPost]
|
||||
public void Post([FromBody]string value)
|
||||
{
|
||||
#if (OrganizationalAuth || WindowsAuth)
|
||||
// For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803
|
||||
#endif
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
#if (OrganizationalAuth || WindowsAuth)
|
||||
// For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803
|
||||
#endif
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
#if (OrganizationalAuth || WindowsAuth)
|
||||
// For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
#if (IncludeApplicationInsights)
|
||||
.UseApplicationInsights()
|
||||
#endif
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
//#if (WindowsAuth)
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
//#else
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
//#endif
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:55556/",
|
||||
//#if (RequiresHttps)
|
||||
"sslPort": 43434
|
||||
//#else
|
||||
"sslPort": 0
|
||||
//#endif
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
//#if (RequiresHttps)
|
||||
"launchUrl": "https://localhost:43434/",
|
||||
//#else
|
||||
"launchUrl": "api/values",
|
||||
//#endif
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
//#if (!WindowsAuth)
|
||||
},
|
||||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000/"
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Company.WebApplication1
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
#if (!OrganizationalAuth)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||
.AddEnvironmentVariables();
|
||||
#else
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
// For more details on using the user secret store see https://go.microsoft.com/fwlink/?LinkID=532709
|
||||
builder.AddUserSecrets<Startup>();
|
||||
}
|
||||
|
||||
builder.AddEnvironmentVariables();
|
||||
#endif
|
||||
Configuration = builder.Build();
|
||||
}
|
||||
|
||||
public IConfigurationRoot Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Add framework services.
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
#if (OrganizationalAuth)
|
||||
|
||||
app.UseJwtBearerAuthentication(new JwtBearerOptions
|
||||
{
|
||||
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
|
||||
Audience = Configuration["Authentication:AzureAd:Audience"]
|
||||
});
|
||||
#endif
|
||||
|
||||
app.UseMvc();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
////#if (OrganizationalAuth)
|
||||
// "Authentication": {
|
||||
// "AzureAd": {
|
||||
// "AADInstance": "https:////login.microsoftonline.com/",
|
||||
// "Audience": "https:////qualified.domain.name/Company.WebApplication1",
|
||||
//#if (SingleOrgAuth)
|
||||
// "ClientId": "11111111-1111-1111-11111111111111111",
|
||||
// "Domain": "qualified.domain.name",
|
||||
// "TenantId": "22222222-2222-2222-2222-222222222222"
|
||||
//#else
|
||||
// "ClientId": "11111111-1111-1111-11111111111111111"
|
||||
//#endif
|
||||
// }
|
||||
// },
|
||||
//#endif
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"TargetFrameworkOverride": {
|
||||
"isHidden": "true",
|
||||
"longName": "target-framework-override",
|
||||
"shortName": ""
|
||||
},
|
||||
"Framework": {
|
||||
"longName": "framework"
|
||||
},
|
||||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"IncludeApplicationInsights": {
|
||||
"isHidden": "true"
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"--framework netcoreapp1.1"
|
||||
]
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Microsoft",
|
||||
"classifications": ["Web", "WebAPI"],
|
||||
"name": "ASP.NET Core Web API",
|
||||
"generatorVersions": "[1.0.0.0-*)",
|
||||
"description": "A project template for creating an ASP.NET Core application with an example Controller for a RESTful HTTP service. This template can also be used for ASP.NET Core MVC Views and Controllers.",
|
||||
"groupIdentity": "Microsoft.Web.WebApi",
|
||||
"precedence": "100",
|
||||
"identity": "Microsoft.Web.WebApi.FSharp",
|
||||
"shortName": "webapi",
|
||||
"thirdPartyNotices": "https://aka.ms/template-3pn",
|
||||
"tags": {
|
||||
"language": "F#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "Company.WebApplication1",
|
||||
"preferNameDirectory": true,
|
||||
"symbols": {
|
||||
"IncludeApplicationInsights": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether or not to include Application Insights in the project"
|
||||
},
|
||||
"TargetFrameworkOverride": {
|
||||
"type": "parameter",
|
||||
"description": "Overrides the target framework",
|
||||
"replaces": "TargetFrameworkOverride",
|
||||
"datatype": "string",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "netcoreapp1.0",
|
||||
"description": "Target netcoreapp1.0"
|
||||
},
|
||||
{
|
||||
"choice": "netcoreapp1.1",
|
||||
"description": "Target netcoreapp1.1"
|
||||
}
|
||||
],
|
||||
"defaultValue": "netcoreapp1.1"
|
||||
},
|
||||
"copyrightYear": {
|
||||
"type": "generated",
|
||||
"generator": "now",
|
||||
"replaces": "1975",
|
||||
"parameters": {
|
||||
"format": "yyyy"
|
||||
}
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [ { "path": "Company.WebApplication1.fsproj" } ],
|
||||
"defaultName": "WebApplication1",
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [
|
||||
{ "text": "Run 'dotnet restore'" }
|
||||
],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="'$(Framework)' != 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Framework)' == 'netcoreapp1.1' AND '$(TargetFrameworkOverride)' == ''">netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers/*.fs" />
|
||||
<Compile Include="Startup.fs" />
|
||||
<Compile Include="Program.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" Condition="'$(IncludeApplicationInsights)' == 'True'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.7" Condition="'$(Framework)' != 'netcoreapp1.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.4" Condition="'$(Framework)' == 'netcoreapp1.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче