Merge branch 'release/2.1' into dev
This commit is contained in:
commit
1ec7a68e7a
|
|
@ -19,6 +19,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authen
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.AzureAD.UI.Test", "test\Microsoft.AspNetCore.Authentication.AzureAD.UI.Test\Microsoft.AspNetCore.Authentication.AzureAD.UI.Test.csproj", "{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.AzureAD.UI.Test", "test\Microsoft.AspNetCore.Authentication.AzureAD.UI.Test\Microsoft.AspNetCore.Authentication.AzureAD.UI.Test.csproj", "{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests", "test\Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests\Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests.csproj", "{1967296B-614B-43E5-B1BA-A601579961D5}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebSites", "WebSites", "{2AEF59C3-7ADA-404D-B965-26B700FBD03F}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureAD.WebSite", "test\WebSites\AzureAD.WebSite\AzureAD.WebSite.csproj", "{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -45,6 +51,14 @@ Global
|
||||||
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1967296B-614B-43E5-B1BA-A601579961D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1967296B-614B-43E5-B1BA-A601579961D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1967296B-614B-43E5-B1BA-A601579961D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1967296B-614B-43E5-B1BA-A601579961D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -55,6 +69,9 @@ Global
|
||||||
{454089F9-ED16-4A11-9C52-2BA74DCF5D35} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
{454089F9-ED16-4A11-9C52-2BA74DCF5D35} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
||||||
{1762840C-A14A-4498-9883-CC671956F0F2} = {75A812B0-D98C-45F3-B2A9-357BBDF7331A}
|
{1762840C-A14A-4498-9883-CC671956F0F2} = {75A812B0-D98C-45F3-B2A9-357BBDF7331A}
|
||||||
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
||||||
|
{1967296B-614B-43E5-B1BA-A601579961D5} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
||||||
|
{2AEF59C3-7ADA-404D-B965-26B700FBD03F} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
|
||||||
|
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316} = {2AEF59C3-7ADA-404D-B965-26B700FBD03F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C6DBF56C-E862-46EA-A4E0-993D2950D78D}
|
SolutionGuid = {C6DBF56C-E862-46EA-A4E0-993D2950D78D}
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,33 @@
|
||||||
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
|
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
|
||||||
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
|
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
|
||||||
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
|
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreAuthorizationPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreDataProtectionExtensionsPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreDataProtectionExtensionsPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreHostingPackageVersion>
|
||||||
<MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreHttpsPolicyPackageVersion>
|
<MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreHttpsPolicyPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreMvcPackageVersion>
|
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreMvcPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreMvcTestingPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreMvcTestingPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview3-32037</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
|
||||||
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingConfigurationPackageVersion>
|
||||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingConsolePackageVersion>
|
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||||
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingDebugPackageVersion>
|
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview3-32037</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||||
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26314-02</MicrosoftNETCoreApp21PackageVersion>
|
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26325-03</MicrosoftNETCoreApp21PackageVersion>
|
||||||
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
||||||
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
||||||
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
|
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
|
||||||
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||||
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
|
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
@{
|
@using Microsoft.AspNetCore.Hosting
|
||||||
Layout = "_Layout";
|
@using Microsoft.AspNetCore.Mvc.ViewEngines
|
||||||
}
|
|
||||||
|
@inject IHostingEnvironment Environment
|
||||||
|
@inject ICompositeViewEngine Engine
|
||||||
|
|
||||||
|
@{
|
||||||
|
var result = Engine.FindView(ViewContext, "_Layout", isMainPage: false);
|
||||||
|
if (result.Success)
|
||||||
|
{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
|
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
|
||||||
|
|
||||||
builder.Services.Configure(scheme, configureOptions);
|
builder.Services.Configure(scheme, configureOptions);
|
||||||
builder.AddJwtBearer();
|
builder.AddJwtBearer(jwtBearerScheme, o => { });
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ namespace Microsoft.AspNetCore.Authentication.AzureAD.UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClientId { get; set; }
|
public string ClientId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the client secret.
|
||||||
|
/// </summary>
|
||||||
|
public string ClientSecret { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the tenant Id.
|
/// Gets or sets the tenant Id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureAD.UI
|
||||||
}
|
}
|
||||||
|
|
||||||
options.ClientId = azureADOptions.ClientId;
|
options.ClientId = azureADOptions.ClientId;
|
||||||
|
options.ClientSecret = azureADOptions.ClientSecret;
|
||||||
options.Authority = new Uri(new Uri(azureADOptions.Instance), azureADOptions.TenantId).ToString();
|
options.Authority = new Uri(new Uri(azureADOptions.Instance), azureADOptions.TenantId).ToString();
|
||||||
options.CallbackPath = azureADOptions.CallbackPath ?? options.CallbackPath;
|
options.CallbackPath = azureADOptions.CallbackPath ?? options.CallbackPath;
|
||||||
options.SignedOutCallbackPath = azureADOptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;
|
options.SignedOutCallbackPath = azureADOptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
@{
|
@using Microsoft.AspNetCore.Hosting
|
||||||
Layout = "_Layout";
|
@using Microsoft.AspNetCore.Mvc.ViewEngines
|
||||||
}
|
|
||||||
|
@inject IHostingEnvironment Environment
|
||||||
|
@inject ICompositeViewEngine Engine
|
||||||
|
|
||||||
|
@{
|
||||||
|
var result = Engine.FindView(ViewContext, "_Layout", isMainPage: false);
|
||||||
|
if (result.Success)
|
||||||
|
{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -52,7 +52,6 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
string jwtBearerScheme,
|
string jwtBearerScheme,
|
||||||
Action<AzureADB2COptions> configureOptions)
|
Action<AzureADB2COptions> configureOptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
builder.AddPolicyScheme(scheme, displayName: null, configureOptions: o =>
|
builder.AddPolicyScheme(scheme, displayName: null, configureOptions: o =>
|
||||||
{
|
{
|
||||||
o.ForwardDefault = jwtBearerScheme;
|
o.ForwardDefault = jwtBearerScheme;
|
||||||
|
|
@ -65,7 +64,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
|
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
|
||||||
|
|
||||||
builder.Services.Configure(scheme, configureOptions);
|
builder.Services.Configure(scheme, configureOptions);
|
||||||
builder.AddJwtBearer();
|
builder.AddJwtBearer(jwtBearerScheme, o => { });
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,11 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClientId { get; set; }
|
public string ClientId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the client secret.
|
||||||
|
/// </summary>
|
||||||
|
public string ClientSecret { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Azure Active Directory B2C instance.
|
/// Gets or sets the Azure Active Directory B2C instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
|
||||||
}
|
}
|
||||||
|
|
||||||
options.ClientId = azureADB2COptions.ClientId;
|
options.ClientId = azureADB2COptions.ClientId;
|
||||||
|
options.ClientSecret = azureADB2COptions.ClientSecret;
|
||||||
options.Authority = BuildAuthority(azureADB2COptions);
|
options.Authority = BuildAuthority(azureADB2COptions);
|
||||||
options.CallbackPath = azureADB2COptions.CallbackPath ?? options.CallbackPath;
|
options.CallbackPath = azureADB2COptions.CallbackPath ?? options.CallbackPath;
|
||||||
options.SignedOutCallbackPath = azureADB2COptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;
|
options.SignedOutCallbackPath = azureADB2COptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AzureAD.WebSite;
|
||||||
|
using Microsoft.AspNetCore.Authentication.AzureAD.UI;
|
||||||
|
using Microsoft.AspNetCore.Authentication.AzureADB2C.UI;
|
||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.AspNetCore.TestHost;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests
|
||||||
|
{
|
||||||
|
public class ApiAuthenticationTests : IClassFixture<WebApplicationFactory<Startup>>
|
||||||
|
{
|
||||||
|
public ApiAuthenticationTests(WebApplicationFactory<Startup> fixture)
|
||||||
|
{
|
||||||
|
Factory = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebApplicationFactory<Startup> Factory { get; }
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task BearerAzureAD_Challenges_UnauthorizedRequests()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var client = Factory.WithWebHostBuilder(builder => builder.ConfigureTestServices(
|
||||||
|
services =>
|
||||||
|
{
|
||||||
|
services.AddAuthentication(AzureADDefaults.BearerAuthenticationScheme)
|
||||||
|
.AddAzureADBearer(o =>
|
||||||
|
{
|
||||||
|
o.Instance = "https://login.microsoftonline.com/";
|
||||||
|
o.Domain = "test.onmicrosoft.com";
|
||||||
|
o.ClientId = "ClientId";
|
||||||
|
o.TenantId = "TenantId";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.Configure<JwtBearerOptions>(AzureADDefaults.JwtBearerAuthenticationScheme, o =>
|
||||||
|
{
|
||||||
|
o.Configuration = new OpenIdConnectConfiguration()
|
||||||
|
{
|
||||||
|
Issuer = "https://www.example.com",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})).CreateDefaultClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.GetAsync("/api/get");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task BearerAzureADB2C_Challenges_UnauthorizedRequests()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var client = Factory.WithWebHostBuilder(builder => builder.ConfigureTestServices(
|
||||||
|
services =>
|
||||||
|
{
|
||||||
|
services.AddAuthentication(AzureADB2CDefaults.BearerAuthenticationScheme)
|
||||||
|
.AddAzureADB2CBearer(o =>
|
||||||
|
{
|
||||||
|
o.Instance = "https://login.microsoftonline.com/";
|
||||||
|
o.Domain = "test.onmicrosoft.com";
|
||||||
|
o.ClientId = "ClientId";
|
||||||
|
o.SignUpSignInPolicyId = "B2c_1_SiSu";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.Configure<JwtBearerOptions>(AzureADB2CDefaults.JwtBearerAuthenticationScheme, o =>
|
||||||
|
{
|
||||||
|
o.Configuration = new OpenIdConnectConfiguration()
|
||||||
|
{
|
||||||
|
Issuer = "https://www.example.com",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})).CreateDefaultClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.GetAsync("/api/get");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
|
||||||
|
<PlatformTarget Condition=" '$(TargetFramework)' == 'netcoreapp2.1' "></PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WebSites\AzureAD.WebSite\AzureAD.WebSite.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreMvcTestingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,162 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AzureAD.WebSite;
|
||||||
|
using Microsoft.AspNetCore.Authentication.AzureAD.UI;
|
||||||
|
using Microsoft.AspNetCore.Authentication.AzureADB2C.UI;
|
||||||
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.AspNetCore.TestHost;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests
|
||||||
|
{
|
||||||
|
public class WebAuthenticationTests : IClassFixture<WebApplicationFactory<Startup>>
|
||||||
|
{
|
||||||
|
public WebAuthenticationTests(WebApplicationFactory<Startup> fixture)
|
||||||
|
{
|
||||||
|
Factory = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebApplicationFactory<Startup> Factory { get; }
|
||||||
|
|
||||||
|
public static TheoryData<string> NotAddedEndpoints =>
|
||||||
|
new TheoryData<string>()
|
||||||
|
{
|
||||||
|
"/AzureAD/Account/AccessDenied",
|
||||||
|
"/AzureAD/Account/Error",
|
||||||
|
"/AzureAD/Account/SignedOut",
|
||||||
|
"/AzureAD/Account/SignIn",
|
||||||
|
"/AzureAD/Account/SignOut",
|
||||||
|
"/AzureADB2C/Account/AccessDenied",
|
||||||
|
"/AzureADB2C/Account/Error",
|
||||||
|
"/AzureADB2C/Account/SignedOut",
|
||||||
|
"/AzureADB2C/Account/SignIn",
|
||||||
|
"/AzureADB2C/Account/ResetPassword",
|
||||||
|
"/AzureADB2C/Account/EditProfile",
|
||||||
|
"/AzureADB2C/Account/SignOut",
|
||||||
|
};
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(NotAddedEndpoints))]
|
||||||
|
public async Task Endpoints_NotAvailable_When_Authentication_NotAdded(string endpoint)
|
||||||
|
{
|
||||||
|
// Act & Assert
|
||||||
|
var response = await Factory.CreateDefaultClient().GetAsync(endpoint);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TheoryData<string, HttpStatusCode> AddedEndpointsStatusCodesAD =>
|
||||||
|
new TheoryData<string, HttpStatusCode>()
|
||||||
|
{
|
||||||
|
{ "/AzureAD/Account/AccessDenied", HttpStatusCode.OK },
|
||||||
|
{ "/AzureAD/Account/Error", HttpStatusCode.OK },
|
||||||
|
{ "/AzureAD/Account/SignedOut", HttpStatusCode.OK },
|
||||||
|
{ "/AzureAD/Account/SignIn", HttpStatusCode.Redirect },
|
||||||
|
{ "/AzureAD/Account/SignOut", HttpStatusCode.Redirect },
|
||||||
|
};
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(AddedEndpointsStatusCodesAD))]
|
||||||
|
public async Task ADEndpoints_AreAvailable_When_Authentication_IsAdded(string endpoint, HttpStatusCode expectedStatusCode)
|
||||||
|
{
|
||||||
|
// Act & Assert
|
||||||
|
var client = Factory.WithWebHostBuilder(builder => builder.ConfigureTestServices(
|
||||||
|
services =>
|
||||||
|
{
|
||||||
|
services
|
||||||
|
.AddAuthentication(AzureADDefaults.AuthenticationScheme)
|
||||||
|
.AddAzureAD(o =>
|
||||||
|
{
|
||||||
|
o.Instance = "https://login.microsoftonline.com/";
|
||||||
|
o.Domain = "test.onmicrosoft.com";
|
||||||
|
o.ClientId = "ClientId";
|
||||||
|
o.TenantId = "TenantId";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, o =>
|
||||||
|
{
|
||||||
|
o.Configuration = new OpenIdConnectConfiguration()
|
||||||
|
{
|
||||||
|
Issuer = "https://www.example.com",
|
||||||
|
TokenEndpoint = "https://www.example.com/token",
|
||||||
|
AuthorizationEndpoint = "https://www.example.com/authorize",
|
||||||
|
EndSessionEndpoint = "https://www.example.com/logout"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddMvc(o => o.Filters.Add(
|
||||||
|
new AuthorizeFilter(new AuthorizationPolicyBuilder(new[] { AzureADDefaults.AuthenticationScheme })
|
||||||
|
.RequireAuthenticatedUser().Build())));
|
||||||
|
})).CreateDefaultClient();
|
||||||
|
|
||||||
|
var response = await client.GetAsync(endpoint);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(expectedStatusCode, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TheoryData<string, HttpStatusCode> AddedEndpointsStatusCodesADB2C =>
|
||||||
|
new TheoryData<string, HttpStatusCode>()
|
||||||
|
{
|
||||||
|
{ "/AzureADB2C/Account/AccessDenied", HttpStatusCode.OK },
|
||||||
|
{ "/AzureADB2C/Account/Error", HttpStatusCode.OK },
|
||||||
|
{ "/AzureADB2C/Account/SignedOut", HttpStatusCode.OK },
|
||||||
|
{ "/AzureADB2C/Account/SignIn", HttpStatusCode.Redirect },
|
||||||
|
{ "/AzureADB2C/Account/ResetPassword", HttpStatusCode.Redirect },
|
||||||
|
{ "/AzureADB2C/Account/EditProfile", HttpStatusCode.Redirect },
|
||||||
|
{ "/AzureADB2C/Account/SignOut", HttpStatusCode.Redirect }
|
||||||
|
};
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(AddedEndpointsStatusCodesADB2C))]
|
||||||
|
public async Task ADB2CEndpoints_AreAvailable_When_Authentication_IsAdded(string endpoint, HttpStatusCode expectedStatusCode)
|
||||||
|
{
|
||||||
|
// Act & Assert
|
||||||
|
var client = Factory.WithWebHostBuilder(builder => builder.ConfigureTestServices(
|
||||||
|
services =>
|
||||||
|
{
|
||||||
|
services
|
||||||
|
.AddAuthentication(AzureADB2CDefaults.AuthenticationScheme)
|
||||||
|
.AddAzureADB2C(o =>
|
||||||
|
{
|
||||||
|
o.Instance = "https://login.microsoftonline.com/tfp/";
|
||||||
|
o.ClientId = "ClientId";
|
||||||
|
o.CallbackPath = "/signin-oidc";
|
||||||
|
o.Domain = "test.onmicrosoft.com";
|
||||||
|
o.SignUpSignInPolicyId = "B2C_1_SiUpIn";
|
||||||
|
o.ResetPasswordPolicyId = "B2C_1_SSPR";
|
||||||
|
o.EditProfilePolicyId = "B2C_1_SiPe";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.Configure<OpenIdConnectOptions>(AzureADB2CDefaults.OpenIdScheme, o =>
|
||||||
|
{
|
||||||
|
o.Configuration = new OpenIdConnectConfiguration()
|
||||||
|
{
|
||||||
|
Issuer = "https://www.example.com",
|
||||||
|
TokenEndpoint = "https://www.example.com/token",
|
||||||
|
AuthorizationEndpoint = "https://www.example.com/authorize",
|
||||||
|
EndSessionEndpoint = "https://www.example.com/logout"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddMvc(o => o.Filters.Add(
|
||||||
|
new AuthorizeFilter(new AuthorizationPolicyBuilder(new[] { AzureADB2CDefaults.AuthenticationScheme })
|
||||||
|
.RequireAuthenticatedUser().Build())));
|
||||||
|
})).CreateDefaultClient();
|
||||||
|
|
||||||
|
var response = await client.GetAsync(endpoint);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(expectedStatusCode, response.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"shadowCopy": false
|
||||||
|
}
|
||||||
|
|
@ -47,6 +47,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
{
|
{
|
||||||
o.Instance = "https://login.microsoftonline.com";
|
o.Instance = "https://login.microsoftonline.com";
|
||||||
o.ClientId = "ClientId";
|
o.ClientId = "ClientId";
|
||||||
|
o.ClientSecret = "ClientSecret";
|
||||||
o.CallbackPath = "/signin-oidc";
|
o.CallbackPath = "/signin-oidc";
|
||||||
o.Domain = "domain.onmicrosoft.com";
|
o.Domain = "domain.onmicrosoft.com";
|
||||||
o.TenantId = "Common";
|
o.TenantId = "Common";
|
||||||
|
|
@ -61,6 +62,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
Assert.Equal(AzureADDefaults.CookieScheme, azureADOptions.CookieSchemeName);
|
Assert.Equal(AzureADDefaults.CookieScheme, azureADOptions.CookieSchemeName);
|
||||||
Assert.Equal("https://login.microsoftonline.com", azureADOptions.Instance);
|
Assert.Equal("https://login.microsoftonline.com", azureADOptions.Instance);
|
||||||
Assert.Equal("ClientId", azureADOptions.ClientId);
|
Assert.Equal("ClientId", azureADOptions.ClientId);
|
||||||
|
Assert.Equal("ClientSecret", azureADOptions.ClientSecret);
|
||||||
Assert.Equal("/signin-oidc", azureADOptions.CallbackPath);
|
Assert.Equal("/signin-oidc", azureADOptions.CallbackPath);
|
||||||
Assert.Equal("domain.onmicrosoft.com", azureADOptions.Domain);
|
Assert.Equal("domain.onmicrosoft.com", azureADOptions.Domain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
{
|
{
|
||||||
o.Instance = "https://login.microsoftonline.com/tfp";
|
o.Instance = "https://login.microsoftonline.com/tfp";
|
||||||
o.ClientId = "ClientId";
|
o.ClientId = "ClientId";
|
||||||
|
o.ClientSecret = "ClientSecret";
|
||||||
o.CallbackPath = "/signin-oidc";
|
o.CallbackPath = "/signin-oidc";
|
||||||
o.Domain = "domain.onmicrosoft.com";
|
o.Domain = "domain.onmicrosoft.com";
|
||||||
o.SignUpSignInPolicyId = "B2C_1_SiUpIn";
|
o.SignUpSignInPolicyId = "B2C_1_SiUpIn";
|
||||||
|
|
@ -63,6 +64,7 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
Assert.Equal(AzureADB2CDefaults.CookieScheme, azureADB2COptions.CookieSchemeName);
|
Assert.Equal(AzureADB2CDefaults.CookieScheme, azureADB2COptions.CookieSchemeName);
|
||||||
Assert.Equal("https://login.microsoftonline.com/tfp", azureADB2COptions.Instance);
|
Assert.Equal("https://login.microsoftonline.com/tfp", azureADB2COptions.Instance);
|
||||||
Assert.Equal("ClientId", azureADB2COptions.ClientId);
|
Assert.Equal("ClientId", azureADB2COptions.ClientId);
|
||||||
|
Assert.Equal("ClientSecret", azureADB2COptions.ClientSecret);
|
||||||
Assert.Equal("/signin-oidc", azureADB2COptions.CallbackPath);
|
Assert.Equal("/signin-oidc", azureADB2COptions.CallbackPath);
|
||||||
Assert.Equal("domain.onmicrosoft.com", azureADB2COptions.Domain);
|
Assert.Equal("domain.onmicrosoft.com", azureADB2COptions.Domain);
|
||||||
Assert.Equal("B2C_1_SiUpIn", azureADB2COptions.SignUpSignInPolicyId);
|
Assert.Equal("B2C_1_SiUpIn", azureADB2COptions.SignUpSignInPolicyId);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>$(StandardTestWebsiteTfms)</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="$(MicrosoftAspNetCoreAuthorizationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="$(MicrosoftAspNetCoreDataProtectionExtensionsPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="$(MicrosoftAspNetCoreServerKestrelHttpsPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(MicrosoftExtensionsConfigurationUserSecretsPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="$(MicrosoftExtensionsLoggingConfigurationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Authentication.AzureAD.UI\Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Authentication.AzureADB2C.UI\Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace AzureAD.WebSite.Controllers
|
||||||
|
{
|
||||||
|
public class TestController : Controller
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
[HttpGet("/api/get")]
|
||||||
|
public IActionResult Get() => Ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace AzureAD.WebSite
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
CreateWebHostBuilder(args).Build().Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
|
||||||
|
{
|
||||||
|
var builder = new WebHostBuilder()
|
||||||
|
.UseKestrel((builderContext, options) =>
|
||||||
|
{
|
||||||
|
options.Configure(builderContext.Configuration.GetSection("Kestrel"));
|
||||||
|
})
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||||
|
{
|
||||||
|
var env = hostingContext.HostingEnvironment;
|
||||||
|
|
||||||
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
|
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName));
|
||||||
|
if (appAssembly != null)
|
||||||
|
{
|
||||||
|
config.AddUserSecrets(appAssembly, optional: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.AddEnvironmentVariables();
|
||||||
|
|
||||||
|
if (args != null)
|
||||||
|
{
|
||||||
|
config.AddCommandLine(args);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
|
{
|
||||||
|
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
|
||||||
|
logging.AddConsole();
|
||||||
|
logging.AddDebug();
|
||||||
|
})
|
||||||
|
.UseIISIntegration()
|
||||||
|
.UseDefaultServiceProvider((context, options) =>
|
||||||
|
{
|
||||||
|
options.ValidateScopes = context.HostingEnvironment.IsDevelopment();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (args != null)
|
||||||
|
{
|
||||||
|
builder.UseConfiguration(new ConfigurationBuilder().AddCommandLine(args).Build());
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.UseStartup<Startup>();
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace AzureAD.WebSite
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddMvc();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
app.UseAuthentication();
|
||||||
|
|
||||||
|
app.UseMvc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<Project>
|
||||||
|
<!-- Skip the parent directory so test websites do not get the test package references. -->
|
||||||
|
<Import Project="..\..\Directory.Build.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DeveloperBuildTestWebsiteTfms>netcoreapp2.1</DeveloperBuildTestWebsiteTfms>
|
||||||
|
<StandardTestWebsiteTfms>$(DeveloperBuildTestWebsiteTfms)</StandardTestWebsiteTfms>
|
||||||
|
<StandardTestWebsiteTfms Condition=" '$(DeveloperBuild)' != 'true' ">$(StandardTestWebsiteTfms);netcoreapp2.0</StandardTestWebsiteTfms>
|
||||||
|
<StandardTestWebsiteTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestWebsiteTfms);net461</StandardTestWebsiteTfms>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue