Skip to content

Commit ecafbe7

Browse files
committed
[Fixes #11] Add functional tests for the libraries
1 parent 804eeed commit ecafbe7

File tree

21 files changed

+517
-21
lines changed

21 files changed

+517
-21
lines changed

AADIntegration.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authen
1919
EndProject
2020
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}"
2121
EndProject
22+
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}"
23+
EndProject
24+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebSites", "WebSites", "{2AEF59C3-7ADA-404D-B965-26B700FBD03F}"
25+
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureAD.WebSite", "test\WebSites\AzureAD.WebSite\AzureAD.WebSite.csproj", "{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}"
27+
EndProject
2228
Global
2329
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2430
Debug|Any CPU = Debug|Any CPU
@@ -45,6 +51,14 @@ Global
4551
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Debug|Any CPU.Build.0 = Debug|Any CPU
4652
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.ActiveCfg = Release|Any CPU
4753
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861}.Release|Any CPU.Build.0 = Release|Any CPU
54+
{1967296B-614B-43E5-B1BA-A601579961D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55+
{1967296B-614B-43E5-B1BA-A601579961D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
56+
{1967296B-614B-43E5-B1BA-A601579961D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
57+
{1967296B-614B-43E5-B1BA-A601579961D5}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316}.Release|Any CPU.Build.0 = Release|Any CPU
4862
EndGlobalSection
4963
GlobalSection(SolutionProperties) = preSolution
5064
HideSolutionNode = FALSE
@@ -55,6 +69,9 @@ Global
5569
{454089F9-ED16-4A11-9C52-2BA74DCF5D35} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
5670
{1762840C-A14A-4498-9883-CC671956F0F2} = {75A812B0-D98C-45F3-B2A9-357BBDF7331A}
5771
{3D0CF896-3A9D-4A8F-A343-A2E1A131C861} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
72+
{1967296B-614B-43E5-B1BA-A601579961D5} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
73+
{2AEF59C3-7ADA-404D-B965-26B700FBD03F} = {57F46508-E53D-4F6B-B77C-2EFE95925AEF}
74+
{4DB3C5B2-9FBF-42BC-80B2-2190EB1AE316} = {2AEF59C3-7ADA-404D-B965-26B700FBD03F}
5875
EndGlobalSection
5976
GlobalSection(ExtensibilityGlobals) = postSolution
6077
SolutionGuid = {C6DBF56C-E862-46EA-A4E0-993D2950D78D}

build/dependencies.props

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,36 @@
44
</PropertyGroup>
55
<PropertyGroup Label="Package Versions">
66
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview3-17001</InternalAspNetCoreSdkPackageVersion>
7-
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
8-
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
9-
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
10-
<MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreHttpsPolicyPackageVersion>
11-
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreMvcPackageVersion>
12-
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
13-
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreServerKestrelPackageVersion>
14-
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30464</MicrosoftAspNetCoreStaticFilesPackageVersion>
15-
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview2-30464</MicrosoftExtensionsConfigurationJsonPackageVersion>
16-
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30464</MicrosoftExtensionsLoggingConsolePackageVersion>
17-
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30464</MicrosoftExtensionsLoggingDebugPackageVersion>
7+
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
8+
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
9+
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
10+
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreAuthorizationPackageVersion>
11+
<MicrosoftAspNetCoreDataProtectionExtensionsPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreDataProtectionExtensionsPackageVersion>
12+
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreHostingPackageVersion>
13+
<MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreHttpsPolicyPackageVersion>
14+
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreMvcPackageVersion>
15+
<MicrosoftAspNetCoreMvcTestingPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreMvcTestingPackageVersion>
16+
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
17+
<MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>
18+
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreServerKestrelPackageVersion>
19+
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30484</MicrosoftAspNetCoreStaticFilesPackageVersion>
20+
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
21+
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
22+
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsConfigurationJsonPackageVersion>
23+
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
24+
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsLoggingConfigurationPackageVersion>
25+
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsLoggingConsolePackageVersion>
26+
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsLoggingDebugPackageVersion>
27+
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30484</MicrosoftExtensionsLoggingTestingPackageVersion>
1828
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
19-
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26314-02</MicrosoftNETCoreApp21PackageVersion>
29+
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26325-03</MicrosoftNETCoreApp21PackageVersion>
2030
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
2131
<MoqPackageVersion>4.7.49</MoqPackageVersion>
2232
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
2333
<XunitPackageVersion>2.3.1</XunitPackageVersion>
2434
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
2535
</PropertyGroup>
36+
37+
2638
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
2739
</Project>
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
@{
2-
Layout = "_Layout";
3-
}
1+
@using Microsoft.AspNetCore.Hosting
2+
@using Microsoft.AspNetCore.Mvc.ViewEngines
3+
4+
@inject IHostingEnvironment Environment
5+
@inject ICompositeViewEngine Engine
6+
7+
@{
8+
var result = Engine.FindView(ViewContext, "_Layout", isMainPage: false);
9+
if (result.Success)
10+
{
11+
Layout = "_Layout";
12+
}
13+
}

src/Microsoft.AspNetCore.Authentication.AzureAD.UI/AzureADAuthenticationBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static AuthenticationBuilder AddAzureADBearer(
6363
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
6464

6565
builder.Services.Configure(scheme, configureOptions);
66-
builder.AddJwtBearer();
66+
builder.AddJwtBearer(jwtBearerScheme, o => { });
6767

6868
return builder;
6969
}

src/Microsoft.AspNetCore.Authentication.AzureAD.UI/AzureADOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public class AzureADOptions
3434
/// </summary>
3535
public string ClientId { get; set; }
3636

37+
/// <summary>
38+
/// Gets or sets the client secret.
39+
/// </summary>
40+
public string ClientSecret { get; set; }
41+
3742
/// <summary>
3843
/// Gets or sets the tenant Id.
3944
/// </summary>

src/Microsoft.AspNetCore.Authentication.AzureAD.UI/OpenIdConnectOptionsConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public void Configure(string name, OpenIdConnectOptions options)
2828
}
2929

3030
options.ClientId = azureADOptions.ClientId;
31+
options.ClientSecret = azureADOptions.ClientSecret;
3132
options.Authority = new Uri(new Uri(azureADOptions.Instance), azureADOptions.TenantId).ToString();
3233
options.CallbackPath = azureADOptions.CallbackPath ?? options.CallbackPath;
3334
options.SignedOutCallbackPath = azureADOptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
@{
2-
Layout = "_Layout";
3-
}
1+
@using Microsoft.AspNetCore.Hosting
2+
@using Microsoft.AspNetCore.Mvc.ViewEngines
3+
4+
@inject IHostingEnvironment Environment
5+
@inject ICompositeViewEngine Engine
6+
7+
@{
8+
var result = Engine.FindView(ViewContext, "_Layout", isMainPage: false);
9+
if (result.Success)
10+
{
11+
Layout = "_Layout";
12+
}
13+
}

src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI/AzureAdB2CAuthenticationBuilderExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public static AuthenticationBuilder AddAzureADB2CBearer(
5252
string jwtBearerScheme,
5353
Action<AzureADB2COptions> configureOptions)
5454
{
55-
5655
builder.AddPolicyScheme(scheme, displayName: null, configureOptions: o =>
5756
{
5857
o.ForwardDefault = jwtBearerScheme;
@@ -65,7 +64,7 @@ public static AuthenticationBuilder AddAzureADB2CBearer(
6564
builder.Services.TryAddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsConfiguration>();
6665

6766
builder.Services.Configure(scheme, configureOptions);
68-
builder.AddJwtBearer();
67+
builder.AddJwtBearer(jwtBearerScheme, o => { });
6968

7069
return builder;
7170
}

src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI/AzureAdB2COptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public class AzureADB2COptions
3535
/// </summary>
3636
public string ClientId { get; set; }
3737

38+
/// <summary>
39+
/// Gets or sets the client secret.
40+
/// </summary>
41+
public string ClientSecret { get; set; }
42+
3843
/// <summary>
3944
/// Gets or sets the Azure Active Directory B2C instance.
4045
/// </summary>

src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI/OpenIdConnectOptionsConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public void Configure(string name, OpenIdConnectOptions options)
3030
}
3131

3232
options.ClientId = azureADB2COptions.ClientId;
33+
options.ClientSecret = azureADB2COptions.ClientSecret;
3334
options.Authority = BuildAuthority(azureADB2COptions);
3435
options.CallbackPath = azureADB2COptions.CallbackPath ?? options.CallbackPath;
3536
options.SignedOutCallbackPath = azureADB2COptions.SignedOutCallbackPath ?? options.SignedOutCallbackPath;

0 commit comments

Comments
 (0)