Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>0e0e648770e54b12c2fa81a77538ce1a72fca8af</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20364.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20377.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ff5d4b6c8dbdaeacb6e6159d3f8185118dffd915</Sha>
<Sha>22d6355c4f3c9ac00b0e3abf9d85f2fb07e4787b</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.20364.3">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@
<IdentityServer4StoragePackageVersion>3.0.0</IdentityServer4StoragePackageVersion>
<IdentityServer4EntityFrameworkStoragePackageVersion>3.0.0</IdentityServer4EntityFrameworkStoragePackageVersion>
<MessagePackPackageVersion>2.1.90</MessagePackPackageVersion>
<MicrosoftIdentityWebPackageVersion>0.2.0-preview</MicrosoftIdentityWebPackageVersion>
<MicrosoftIdentityWebUIPackageVersion>0.2.0-preview</MicrosoftIdentityWebUIPackageVersion>
<MicrosoftIdentityWebPackageVersion>0.2.1-preview</MicrosoftIdentityWebPackageVersion>
<MicrosoftIdentityWebUIPackageVersion>0.2.1-preview</MicrosoftIdentityWebUIPackageVersion>
<MicrosoftGraphPackageVersion>3.8.0</MicrosoftGraphPackageVersion>
<MessagePackAnalyzerPackageVersion>$(MessagePackPackageVersion)</MessagePackAnalyzerPackageVersion>
<MoqPackageVersion>4.10.0</MoqPackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"msbuild-sdks": {
"Yarn.MSBuild": "1.15.2",
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20364.3",
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20377.2",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20364.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory, BrowserFix
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
public async Task BlazorServerTemplateWorks_NoAuth()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

Project = await ProjectFactory.GetOrCreateProject("blazorservernoauth", Output);

var createResult = await Project.RunDotNetNewAsync("blazorserver");
Expand Down Expand Up @@ -88,6 +91,9 @@ public async Task BlazorServerTemplateWorks_NoAuth()
[QuarantinedTest]
public async Task BlazorServerTemplateWorks_IndividualAuth(bool useLocalDB)
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

Project = await ProjectFactory.GetOrCreateProject("blazorserverindividual" + (useLocalDB ? "uld" : ""), Output);

var createResult = await Project.RunDotNetNewAsync("blazorserver", auth: "Individual", useLocalDB: useLocalDB);
Expand Down Expand Up @@ -182,5 +188,30 @@ private void TestBasicNavigation()
Browser.Exists(By.CssSelector("table>tbody>tr"));
Browser.Equal(5, () => Browser.FindElements(By.CssSelector("p+table>tbody>tr")).Count);
}

[Theory]
[QuarantinedTest]
[InlineData("IndividualB2C", null)]
[InlineData("IndividualB2C", new string[] { "--called-api-url \"https://graph.microsoft.com\"", "--called-api-scopes user.readwrite" })]
[InlineData("SingleOrg", null)]
[InlineData("SingleOrg", new string[] { "--called-api-url \"https://graph.microsoft.com\"", "--called-api-scopes user.readwrite" })]
[InlineData("SingleOrg", new string[] { "--calls-graph" })]
public async Task BlazorServerTemplat_IdentityWeb_BuildAndPublish(string auth, string[] args)
{
Project = await ProjectFactory.GetOrCreateProject("blazorserveridweb" + Guid.NewGuid().ToString().Substring(0, 10).ToLower(), Output);

var createResult = await Project.RunDotNetNewAsync("blazorserver", auth: auth, args: args);
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", Project, createResult));

var publishResult = await Project.RunDotNetPublishAsync();
Assert.True(0 == publishResult.ExitCode, ErrorMessages.GetFailedProcessMessage("publish", Project, publishResult));

// Run dotnet build after publish. The reason is that one uses Config = Debug and the other uses Config = Release
// The output from publish will go into bin/Release/netcoreappX.Y/publish and won't be affected by calling build
// later, while the opposite is not true.

var buildResult = await Project.RunDotNetBuildAsync();
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public override Task InitializeAsync()
[Fact]
public async Task BlazorWasmStandaloneTemplate_Works()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorstandalone", Output);
project.RuntimeIdentifier = "browser-wasm";

Expand Down Expand Up @@ -81,6 +84,9 @@ public async Task BlazorWasmStandaloneTemplate_Works()
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
public async Task BlazorWasmHostedTemplate_Works()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorhosted", Output);

var createResult = await project.RunDotNetNewAsync("blazorwasm", args: new[] { "--hosted" });
Expand Down Expand Up @@ -135,6 +141,9 @@ private static async Task AssertCompressionFormat(AspNetProcess aspNetProcess, s
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/23992")]
public async Task BlazorWasmStandalonePwaTemplate_Works()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorstandalonepwa", Output);
project.RuntimeIdentifier = "browser-wasm";

Expand Down Expand Up @@ -174,6 +183,9 @@ public async Task BlazorWasmStandalonePwaTemplate_Works()
[Fact]
public async Task BlazorWasmHostedPwaTemplate_Works()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorhostedpwa", Output);

var createResult = await project.RunDotNetNewAsync("blazorwasm", args: new[] { "--hosted", "--pwa" });
Expand Down Expand Up @@ -269,6 +281,9 @@ public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB()

private async Task BlazorWasmHostedTemplate_IndividualAuth_Works(bool useLocalDb)
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorhostedindividual" + (useLocalDb ? "uld" : ""), Output);

var createResult = await project.RunDotNetNewAsync("blazorwasm", args: new[] { "--hosted", "-au", "Individual", useLocalDb ? "-uld" : "" });
Expand Down Expand Up @@ -336,6 +351,9 @@ private async Task BlazorWasmHostedTemplate_IndividualAuth_Works(bool useLocalDb
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/23639")]
public async Task BlazorWasmStandaloneTemplate_IndividualAuth_Works()
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");

var project = await ProjectFactory.GetOrCreateProject("blazorstandaloneindividual", Output);
project.RuntimeIdentifier = "browser-wasm";

Expand Down Expand Up @@ -403,6 +421,27 @@ public async Task BlazorWasmStandaloneTemplate_IndividualAuth_Works()
"--default-scope", "full",
"--app-id-uri", "ApiUri",
"--api-client-id", "1234123413241324"),
new TemplateInstance(
"blazorwasmhostedaadgraph", "-ho",
"-au", "SingleOrg",
"--calls-graph",
"--domain", "my-domain",
"--tenant-id", "tenantId",
"--client-id", "clientId",
"--default-scope", "full",
"--app-id-uri", "ApiUri",
"--api-client-id", "1234123413241324"),
new TemplateInstance(
"blazorwasmhostedaadapi", "-ho",
"-au", "SingleOrg",
"--called-api-url", "\"https://graph.microsoft.com\"",
"--called-api-scopes", "user.readwrite",
"--domain", "my-domain",
"--tenant-id", "tenantId",
"--client-id", "clientId",
"--default-scope", "full",
"--app-id-uri", "ApiUri",
"--api-client-id", "1234123413241324"),
new TemplateInstance(
"blazorwasmstandaloneaadb2c",
"-au", "IndividualB2C",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
<!--#endif -->
<!--#if (IndividualAuth || OrganizationalAuth) -->
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="${MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion}" Condition="'$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="${MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion}" Condition="'$(IndividualB2CAuth)' == 'True'" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.Graph" Version="${MicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' "/>
</ItemGroup>

<!--#endif -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
<!--#endif -->
<!--#if (OrganizationalAuth || IndividualB2CAuth) -->
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="${MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion}" Condition="'$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="${MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion}" Condition="'$(IndividualB2CAuth)' == 'True'" />
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" />
<PackageReference Include="Microsoft.Graph" Version="${MicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' "/>
</ItemGroup>
<!--#endif -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@
"NoHttps": {
"longName": "no-https",
"shortName": ""
},
"CalledApiUrl": {
"longName": "called-api-url",
"shortName": ""
},
"CalledApiScopes": {
"longName": "called-api-scopes",
"shortName": ""
},
"CallsMicrosoftGraph": {
"longName": "calls-graph",
"shortName": ""
}
},
"usageExamples": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,52 @@
"Shared/LoginDisplay.IndividualB2CAuth.razor",
"Shared/LoginDisplay.OrganizationalAuth.razor"
]
},
{
"condition": "(!GenerateApi)",
"exclude": [
"Services/DownstreamWebApi.cs",
"Pages/CallWebApi.razor"
]
},
{
"condition": "(!GenerateGraph)",
"exclude": [
"Services/MicrosoftGraphServiceExtensions.cs",
"Services/TokenAcquisitionCredentialProvider.cs",
"Shared/NavMenu.CallsMicrosoftGraph.razor",
"Pages/ShowProfile.razor"
]
},
{
"condition": "(!GenerateApiOrGraph)",
"rename": {
"Shared/NavMenu.NoGraphOrApi.razor": "Shared/NavMenu.razor"
},
"exclude": [
"Shared/NavMenu.CallsMicrosoftGraph.razor",
"Shared/NavMenu.CallsWebApi.razor"
]
},
{
"condition": "(GenerateGraph)",
"rename": {
"Shared/NavMenu.CallsMicrosoftGraph.razor": "Shared/NavMenu.razor"
},
"exclude": [
"Shared/NavMenu.NoGraphOrApi.razor",
"Shared/NavMenu.CallsWebApi.razor"
]
},
{
"condition": "(GenerateApi)",
"rename": {
"Shared/NavMenu.CallsWebApi.razor": "Shared/NavMenu.razor"
},
"exclude": [
"Shared/NavMenu.NoGraphOrApi.razor",
"Shared/NavMenu.CallsMicrosoftGraph.razor"
]
}
]
}
Expand Down Expand Up @@ -174,21 +220,28 @@
"SignUpSignInPolicyId": {
"type": "parameter",
"datatype": "string",
"defaultValue": "",
"defaultValue": "b2c_1_susi",
"replaces": "MySignUpSignInPolicyId",
"description": "The sign-in and sign-up policy ID for this project (use with IndividualB2C auth)."
},
"SignedOutCallbackPath": {
"type": "parameter",
"datatype": "string",
"defaultValue": "/signout/B2C_1_susi",
"replaces": "/signout/MySignUpSignInPolicyId",
"description": "The global signout callback (use with IndividualB2C auth)."
},
"ResetPasswordPolicyId": {
"type": "parameter",
"datatype": "string",
"defaultValue": "",
"defaultValue": "b2c_1_reset",
"replaces": "MyResetPasswordPolicyId",
"description": "The reset password policy ID for this project (use with IndividualB2C auth)."
},
"EditProfilePolicyId": {
"type": "parameter",
"datatype": "string",
"defaultValue": "",
"defaultValue": "b2c_1_edit_profile",
"replaces": "MyEditProfilePolicyId",
"description": "The edit profile policy ID for this project (use with IndividualB2C auth)."
},
Expand Down Expand Up @@ -352,6 +405,37 @@
"format": "yyyy"
}
},
"CalledApiUrl": {
"type": "parameter",
"datatype": "string",
"replaces": "[WebApiUrl]",
"defaultValue" : "https://graph.microsoft.com/beta",
"description": "URL of the API to call from the web app. This option only applies if --auth SingleOrg, --auth MultiOrg or --auth IndividualB2C is specified."
},
"CallsMicrosoftGraph": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Specifies if the web app calls Microsoft Graph. This option only applies if --auth SingleOrg or --auth MultiOrg is specified."
},
"CalledApiScopes": {
"type": "parameter",
"datatype": "string",
"replaces" : "user.read",
"description": "Scopes to request to call the API from the web app. This option only applies if --auth SingleOrg, --auth MultiOrg or --auth IndividualB2C is specified."
},
"GenerateApi": {
"type": "computed",
"value": "((IndividualB2CAuth || OrganizationalAuth) && (CalledApiUrl != \"https://graph.microsoft.com/beta\" || CalledApiScopes != \"user.read\"))"
},
"GenerateGraph": {
"type": "computed",
"value": "(OrganizationalAuth && CallsMicrosoftGraph)"
},
"GenerateApiOrGraph": {
"type": "computed",
"value": "(GenerateApi || GenerateGraph)"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
@if (SignInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a>
<a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a>
</li>
<li class="nav-item">
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post">
<form class="form-inline" asp-area="MicrosoftIdentity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post">
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
</form>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
<a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-page="/Account/Register">Register</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
<a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-page="/Account/Login">Login</a>
</li>
}
</ul>
Loading