From ba76681f6318d961b13c06aad39eddd0ea98101c Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada Date: Wed, 26 Apr 2023 17:19:43 +0200 Subject: [PATCH 01/17] update version of Microsoft.Identity.Web and Microsoft.Identity.Web.UI to 2.7.0 --- eng/Versions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 444074e1980f..5ca7fd36c6ab 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -269,9 +269,9 @@ 6.0.4 6.0.4 2.5.108 - 1.16.0 - 1.16.0 - 1.16.0 + 2.7.0 + 2.7.0 + 2.7.0 $(MessagePackVersion) 4.10.0 0.11.2 From 201662eaf676a25b0e0195ce3605e0241a414cea Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada Date: Wed, 10 May 2023 16:25:27 +0200 Subject: [PATCH 02/17] update to 2.10.0 --- eng/Versions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 5ca7fd36c6ab..66b8d669bedc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -269,9 +269,9 @@ 6.0.4 6.0.4 2.5.108 - 2.7.0 - 2.7.0 - 2.7.0 + 2.10.0 + 2.10.0 + 2.10.0 $(MessagePackVersion) 4.10.0 0.11.2 From f7549b4c049a86a1e574d05735dd7be990aa7e70 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada Date: Thu, 11 May 2023 19:24:08 +0200 Subject: [PATCH 03/17] migrated from DownstreamWebApi to DownstreamApi --- eng/Versions.props | 1 + ...NonParsableComplexTypesOnParametersTest.cs | 4 +- .../BlazorServerWeb-CSharp.csproj.in | 1 + ...ponentsWebAssembly-CSharp.Server.csproj.in | 1 + ...crosoft.DotNet.Web.ProjectTemplates.csproj | 1 + .../RazorPagesWeb-CSharp.csproj.in | 1 + .../StarterWeb-CSharp.csproj.in | 1 + .../WebApi-CSharp.csproj.in | 1 + .../Pages/CallWebApi.razor | 5 +- .../BlazorServerWeb-CSharp/Program.Main.cs | 4 +- .../content/BlazorServerWeb-CSharp/Program.cs | 4 +- .../BlazorServerWeb-CSharp/appsettings.json | 118 +++++++-------- .../Controllers/WeatherForecastController.cs | 9 +- .../Server/Program.Main.cs | 4 +- .../Server/Program.cs | 4 +- .../Server/appsettings.json | 138 +++++++++--------- .../Pages/Index.cshtml.cs | 11 +- .../RazorPagesWeb-CSharp/Program.Main.cs | 4 +- .../content/RazorPagesWeb-CSharp/Program.cs | 4 +- .../RazorPagesWeb-CSharp/appsettings.json | 118 +++++++-------- .../Controllers/HomeController.cs | 11 +- .../content/StarterWeb-CSharp/Program.Main.cs | 4 +- .../content/StarterWeb-CSharp/Program.cs | 4 +- .../StarterWeb-CSharp/appsettings.json | 118 +++++++-------- .../Controllers/WeatherForecastController.cs | 9 +- .../content/WebApi-CSharp/Program.Main.cs | 9 +- ...gram.MinimalAPIs.OrgOrIndividualB2CAuth.cs | 9 +- .../content/WebApi-CSharp/Program.cs | 4 +- .../content/WebApi-CSharp/appsettings.json | 104 ++++++------- 29 files changed, 365 insertions(+), 341 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 66b8d669bedc..793c8e31c654 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -272,6 +272,7 @@ 2.10.0 2.10.0 2.10.0 + 2.10.0 $(MessagePackVersion) 4.10.0 0.11.2 diff --git a/src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DisallowNonParsableComplexTypesOnParametersTest.cs b/src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DisallowNonParsableComplexTypesOnParametersTest.cs index aaa80f6db2c1..6651effa31fa 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DisallowNonParsableComplexTypesOnParametersTest.cs +++ b/src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DisallowNonParsableComplexTypesOnParametersTest.cs @@ -648,10 +648,10 @@ public async Task Handler_Parameter_withServiceInterface_Works() using Microsoft.AspNetCore.Builder; var webApp = WebApplication.Create(); -webApp.MapGet("/weatherforecast", (HttpContext context, IDownstreamWebApi downstreamWebApi) => {}); +webApp.MapGet("/weatherforecast", (HttpContext context, IDownstreamApi downstreamApi) => {}); // This type doesn't need to be parsable because it should be assumed to be a service type. -public interface IDownstreamWebApi +public interface IDownstreamApi { } """; diff --git a/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in index 27c7c22f3c2c..91c984f41385 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in @@ -31,6 +31,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in index 5d2cb0e520ee..ce7e7693a46a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in @@ -45,6 +45,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj index 67ffc2559937..b670f813b970 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj @@ -22,6 +22,7 @@ MicrosoftIdentityWebVersion=$(MicrosoftIdentityWebVersion); MicrosoftIdentityWebMicrosoftGraphVersion=$(MicrosoftIdentityWebMicrosoftGraphVersion); MicrosoftIdentityWebUIVersion=$(MicrosoftIdentityWebUIVersion); + MicrosoftIdentityWebDownstreamApiVersion$(MicrosoftIdentityWebDownstreamApiVersion); MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion); SystemNetHttpJsonVersion=$(SystemNetHttpJsonVersion); MicrosoftGraphVersion=$(MicrosoftGraphVersion); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in index 6048bfc0fb4a..693f5fe00ef1 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in @@ -29,6 +29,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in index b1cc65340e1d..7aa4b869201d 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in @@ -29,6 +29,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in index e79188f36d01..f8ecbd7844ab 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in @@ -18,6 +18,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/CallWebApi.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/CallWebApi.razor index beac855d317a..b6132c605ec0 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/CallWebApi.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/CallWebApi.razor @@ -2,8 +2,9 @@ @using BlazorServerWeb_CSharp @using Microsoft.Identity.Web +@using Microsoft.Identity.Abstractions -@inject IDownstreamWebApi downstreamAPI +@inject IDownstreamApi downstreamAPI @inject MicrosoftIdentityConsentAndConditionalAccessHandler ConsentHandler

Call an API

@@ -28,7 +29,7 @@ else { try { - response = await downstreamAPI.CallWebApiForUserAsync( + response = await downstreamAPI.CallApiForUserAsync( "DownstreamApi", options => options.RelativePath = ""); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.Main.cs index cc3c8ab895b3..ca30b112ea8c 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.Main.cs @@ -67,7 +67,7 @@ public static void Main(string[] args) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -85,7 +85,7 @@ public static void Main(string[] args) #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.cs index 8056669b00f8..0b1391e4464b 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Program.cs @@ -61,7 +61,7 @@ .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -79,7 +79,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json index 5292d34e9e9a..4f3327974996 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json @@ -1,65 +1,67 @@ { -////#if (IndividualB2CAuth) -// "AzureAdB2C": { -// "Instance": "https:////login.microsoftonline.com/tfp/", -// "ClientId": "11111111-1111-1111-11111111111111111", -// "CallbackPath": "/signin-oidc", -// "Domain": "qualified.domain.name", -// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", -//#if (GenerateApi) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", -// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", -// "EditProfilePolicyId": "MyEditProfilePolicyId" -// }, -////#elseif (OrganizationalAuth) -///* + ////#if (IndividualB2CAuth) + // "AzureAdB2C": { + // "Instance": "https:////login.microsoftonline.com/tfp/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "CallbackPath": "/signin-oidc", + // "Domain": "qualified.domain.name", + // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", + // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", + // "EditProfilePolicyId": "MyEditProfilePolicyId" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAd": { -// "Instance": "https:////login.microsoftonline.com/", -//#if (MultiOrgAuth) -// "TenantId": "common", -//#elseif (SingleOrgAuth) -// "Domain": "qualified.domain.name", -// "TenantId": "22222222-2222-2222-2222-222222222222", -//#endif -// "ClientId": "11111111-1111-1111-11111111111111111", -//#if (GenerateApiOrGraph) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "CallbackPath": "/signin-oidc" -// }, -////#endif -////#if (GenerateApiOrGraph) -// "DownstreamApi": { -// /* -// 'Scopes' contains space separated scopes of the Web API you want to call. This can be: -// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) -// - a scope corresponding to a V1 application (for instance /.default, where is the -// App ID URI of a legacy v1 Web application -// Applications are registered in the https://portal.azure.com portal. -// */ -// "BaseUrl": "[WebApiUrl]", -// "Scopes": "user.read" -// }, -////#endif -////#if (IndividualLocalAuth) -// "ConnectionStrings": { -//#if (UseLocalDB) -// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" -//#else -// "DefaultConnection": "DataSource=app.db;Cache=Shared" -//#endif -// }, -////#endif + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (MultiOrgAuth) + // "TenantId": "common", + //#elseif (SingleOrgAuth) + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif + ////#if (IndividualLocalAuth) + // "ConnectionStrings": { + //#if (UseLocalDB) + // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" + //#else + // "DefaultConnection": "DataSource=app.db;Cache=Shared" + //#endif + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs index 52fab2ac5dbb..7f9c35470eb7 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs @@ -3,6 +3,7 @@ #endif #if (GenerateApi) using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; using System.Net; #endif #if (GenerateGraph) @@ -36,19 +37,19 @@ public class WeatherForecastController : ControllerBase private readonly ILogger _logger; #if (GenerateApi) - private readonly IDownstreamWebApi _downstreamWebApi; + private readonly IDownstreamApi _downstreamApi; public WeatherForecastController(ILogger logger, - IDownstreamWebApi downstreamWebApi) + IDownstreamApi downstreamApi) { _logger = logger; - _downstreamWebApi = downstreamWebApi; + _downstreamApi = downstreamApi; } [HttpGet] public async Task> Get() { - using var response = await _downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await _downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.Main.cs index cc52a2ed54b9..c503b8292039 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.Main.cs @@ -53,7 +53,7 @@ public static void Main(string[] args) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi() #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -67,7 +67,7 @@ public static void Main(string[] args) #if (GenerateApi) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi() - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.cs index 3a44aefeb9f9..885e23ce075f 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Program.cs @@ -47,7 +47,7 @@ .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi() #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -61,7 +61,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi() - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json index 2117429dd5d2..f2a321b29656 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json @@ -1,81 +1,83 @@ { -////#if (IndividualLocalAuth) -// "ConnectionStrings": { -////#if (UseLocalDB) -// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-ComponentsWebAssembly_CSharp.Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" -////#else -// "DefaultConnection": "DataSource=app.db" -////#endif -// }, -////#elseif (IndividualB2CAuth) -///* + ////#if (IndividualLocalAuth) + // "ConnectionStrings": { + ////#if (UseLocalDB) + // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-ComponentsWebAssembly_CSharp.Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" + ////#else + // "DefaultConnection": "DataSource=app.db" + ////#endif + // }, + ////#elseif (IndividualB2CAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAdB2C": { -// "Instance": "https:////aadB2CInstance.b2clogin.com/", -// "ClientId": "11111111-1111-1111-11111111111111111", -// "Domain": "qualified.domain.name", -//#if (GenerateApi) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "Scopes": "api-scope", -// "SignUpSignInPolicyId": "MySignUpSignInPolicyId" -// }, -////#elseif (OrganizationalAuth) -///* +For more info see https:////aka.ms/dotnet-template-ms-identity-platform + //*/ + // "AzureAdB2C": { + // "Instance": "https:////aadB2CInstance.b2clogin.com/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "Domain": "qualified.domain.name", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "Scopes": "api-scope", + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAd": { -// "Instance": "https:////login.microsoftonline.com/", -//#if (!SingleOrgAuth) -// "TenantId": "common", -//#else -// "Domain": "qualified.domain.name", -// "TenantId": "22222222-2222-2222-2222-222222222222", -//#endif -// "ClientId": "11111111-1111-1111-11111111111111111", -//#if (GenerateApiOrGraph) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "Scopes": "api-scope", -// "CallbackPath": "/signin-oidc" -// }, -////#endif -////#if (GenerateApiOrGraph) -// "DownstreamApi": { -// /* -// 'Scopes' contains space separated scopes of the Web API you want to call. This can be: -// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) -// - a scope corresponding to a V1 application (for instance /.default, where is the -// App ID URI of a legacy v1 Web application -// Applications are registered in the https://portal.azure.com portal. -// */ -// "BaseUrl": "[WebApiUrl]", -// "Scopes": "user.read" -// }, -////#endif +For more info see https:////aka.ms/dotnet-template-ms-identity-platform + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (!SingleOrgAuth) + // "TenantId": "common", + //#else + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "Scopes": "api-scope", + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, -////#if (IndividualLocalAuth) -// "IdentityServer": { -// "Clients": { -// "ComponentsWebAssembly_CSharp.Client": { -// "Profile": "IdentityServerSPA" -// } -// } -// }, -////#endif + ////#if (IndividualLocalAuth) + // "IdentityServer": { + // "Clients": { + // "ComponentsWebAssembly_CSharp.Client": { + // "Profile": "IdentityServerSPA" + // } + // } + // }, + ////#endif "AllowedHosts": "*" } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs index af4794371e82..1e6a3050e5e5 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs @@ -1,4 +1,4 @@ -#if (GenerateApiOrGraph) +#if (GenerateApiOrGraph) using System.Net; #endif using Microsoft.AspNetCore.Mvc; @@ -8,6 +8,7 @@ #endif #if (GenerateApiOrGraph) using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; #endif namespace Company.WebApplication1.Pages; @@ -20,18 +21,18 @@ public class IndexModel : PageModel private readonly ILogger _logger; #if (GenerateApi) - private readonly IDownstreamWebApi _downstreamWebApi; + private readonly IDownstreamApi _downstreamApi; public IndexModel(ILogger logger, - IDownstreamWebApi downstreamWebApi) + IDownstreamApi downstreamApi) { _logger = logger; - _downstreamWebApi = downstreamWebApi; + _downstreamApi = downstreamApi; } public async Task OnGet() { - using var response = await _downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await _downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.Main.cs index dd471686ceeb..bce4b6039495 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.Main.cs @@ -62,7 +62,7 @@ public static void Main(string[] args) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -80,7 +80,7 @@ public static void Main(string[] args) #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs index 936ac7591442..948286a94361 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs @@ -56,7 +56,7 @@ .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -74,7 +74,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json index cf9667fd139f..5c8f9b352caa 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json @@ -1,65 +1,67 @@ { -////#if (IndividualB2CAuth) -// "AzureAdB2C": { -// "Instance": "https:////login.microsoftonline.com/tfp/", -// "ClientId": "11111111-1111-1111-11111111111111111", -// "CallbackPath": "/signin-oidc", -// "Domain": "qualified.domain.name", -//#if (GenerateApi) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", -// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", -// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", -// "EditProfilePolicyId": "MyEditProfilePolicyId" -// }, -////#elseif (OrganizationalAuth) -///* + ////#if (IndividualB2CAuth) + // "AzureAdB2C": { + // "Instance": "https:////login.microsoftonline.com/tfp/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "CallbackPath": "/signin-oidc", + // "Domain": "qualified.domain.name", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", + // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", + // "EditProfilePolicyId": "MyEditProfilePolicyId" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAd": { -// "Instance": "https:////login.microsoftonline.com/", -//#if (MultiOrgAuth) -// "TenantId": "common", -//#elseif (SingleOrgAuth) -// "Domain": "qualified.domain.name", -// "TenantId": "22222222-2222-2222-2222-222222222222", -//#endif -// "ClientId": "11111111-1111-1111-11111111111111111", -//#if (GenerateApiOrGraph) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "CallbackPath": "/signin-oidc" -// }, -////#endif -////#if (GenerateApiOrGraph) -// "DownstreamApi": { -// /* -// 'Scopes' contains space separated scopes of the Web API you want to call. This can be: -// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) -// - a scope corresponding to a V1 application (for instance /.default, where is the -// App ID URI of a legacy v1 Web application -// Applications are registered in the https://portal.azure.com portal. -// */ -// "BaseUrl": "[WebApiUrl]", -// "Scopes": "user.read" -// }, -////#endif -////#if (IndividualLocalAuth) -// "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;Cache=Shared" -//#endif -// }, -////#endif + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (MultiOrgAuth) + // "TenantId": "common", + //#elseif (SingleOrgAuth) + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif + ////#if (IndividualLocalAuth) + // "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;Cache=Shared" + //#endif + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs index 93e8d95a2afb..d5674f6c5408 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; #if (GenerateApiOrGraph) using System.Net; #endif @@ -11,6 +11,7 @@ #endif #if (GenerateApiOrGraph) using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; #endif using Company.WebApplication1.Models; @@ -24,19 +25,19 @@ public class HomeController : Controller private readonly ILogger _logger; #if (GenerateApi) - private readonly IDownstreamWebApi _downstreamWebApi; + private readonly IDownstreamApi _downstreamApi; public HomeController(ILogger logger, - IDownstreamWebApi downstreamWebApi) + IDownstreamApi downstreamApi) { _logger = logger; - _downstreamWebApi = downstreamWebApi; + _downstreamApi = downstreamApi; } [AuthorizeForScopes(ScopeKeySection = "DownstreamApi:Scopes")] public async Task Index() { - using var response = await _downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await _downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.Main.cs index 4cd34b1c9aee..f7d20fa0f2ee 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.Main.cs @@ -62,7 +62,7 @@ public static void Main(string[] args) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -80,7 +80,7 @@ public static void Main(string[] args) #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs index 8d79c7c94330..46a9fd064067 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs @@ -56,7 +56,7 @@ .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -74,7 +74,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi(initialScopes) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json index d3278a7dd48e..51a8a2d7f02d 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json @@ -1,65 +1,67 @@ { -////#if (IndividualB2CAuth) -// "AzureAdB2C": { -// "Instance": "https:////login.microsoftonline.com/tfp/", -// "ClientId": "11111111-1111-1111-11111111111111111", -// "Domain": "qualified.domain.name", -// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", -// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", -// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", -// "EditProfilePolicyId": "MyEditProfilePolicyId", -//#if (GenerateApi) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "CallbackPath": "/signin-oidc" -// }, -////#elseif (OrganizationalAuth) -///* + ////#if (IndividualB2CAuth) + // "AzureAdB2C": { + // "Instance": "https:////login.microsoftonline.com/tfp/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "Domain": "qualified.domain.name", + // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", + // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", + // "EditProfilePolicyId": "MyEditProfilePolicyId", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "CallbackPath": "/signin-oidc" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAd": { -// "Instance": "https:////login.microsoftonline.com/", -//#if (MultiOrgAuth) -// "TenantId": "common", -//#elseif (SingleOrgAuth) -// "Domain": "qualified.domain.name", -// "TenantId": "22222222-2222-2222-2222-222222222222", -//#endif -// "ClientId": "11111111-1111-1111-11111111111111111", -//#if (GenerateApiOrGraph) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "CallbackPath": "/signin-oidc" -// }, -////#endif -////#if (GenerateApiOrGraph) -// "DownstreamApi": { -// /* -// 'Scopes' contains space separated scopes of the Web API you want to call. This can be: -// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) -// - a scope corresponding to a V1 application (for instance /.default, where is the -// App ID URI of a legacy v1 Web application -// Applications are registered in the https://portal.azure.com portal. -// */ -// "BaseUrl": "[WebApiUrl]", -// "Scopes": "user.read" -// }, -////#endif -////#if (IndividualLocalAuth) -// "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;Cache=Shared" -//#endif -// }, -////#endif + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (MultiOrgAuth) + // "TenantId": "common", + //#elseif (SingleOrgAuth) + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif + ////#if (IndividualLocalAuth) + // "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;Cache=Shared" + //#endif + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs index 1db80ec1fac3..1f0cd2dcae98 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; #if (GenerateApi) using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; #endif #if (OrganizationalAuth || IndividualB2CAuth) using Microsoft.Identity.Web.Resource; @@ -35,13 +36,13 @@ public class WeatherForecastController : ControllerBase private readonly ILogger _logger; #if (GenerateApi) - private readonly IDownstreamWebApi _downstreamWebApi; + private readonly IDownstreamApi _downstreamApi; public WeatherForecastController(ILogger logger, - IDownstreamWebApi downstreamWebApi) + IDownstreamApi downstreamApi) { _logger = logger; - _downstreamWebApi = downstreamWebApi; + _downstreamApi = downstreamApi; } #if (EnableOpenAPI) @@ -51,7 +52,7 @@ public WeatherForecastController(ILogger logger, #endif public async Task> Get() { - using var response = await _downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await _downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs index b74c5afce180..05d80ea12f99 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs @@ -10,6 +10,7 @@ #endif #if (OrganizationalAuth || IndividualB2CAuth) using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; using Microsoft.Identity.Web.Resource; #endif #if (OrganizationalAuth || IndividualB2CAuth || GenerateGraph || WindowsAuth || EnableOpenAPI) @@ -30,7 +31,7 @@ public static void Main(string[] args) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi() #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -44,7 +45,7 @@ public static void Main(string[] args) #if (GenerateApi) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi() - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")); @@ -101,11 +102,11 @@ public static void Main(string[] args) }; #if (GenerateApi) - app.MapGet("/weatherforecast", async (HttpContext httpContext, IDownstreamWebApi downstreamWebApi) => + app.MapGet("/weatherforecast", async (HttpContext httpContext, IDownstreamApi downstreamApi) => { httpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi); - using var response = await downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await downstreamApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.OrgOrIndividualB2CAuth.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.OrgOrIndividualB2CAuth.cs index d767b12fd007..587cb84bdd24 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.OrgOrIndividualB2CAuth.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.OrgOrIndividualB2CAuth.cs @@ -7,6 +7,7 @@ using Graph = Microsoft.Graph; #endif using Microsoft.Identity.Web; +using Microsoft.Identity.Abstractions; using Microsoft.Identity.Web.Resource; var builder = WebApplication.CreateBuilder(args); @@ -18,7 +19,7 @@ .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi() #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -32,7 +33,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi() - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")); @@ -68,11 +69,11 @@ }; #if (GenerateApi) -app.MapGet("/weatherforecast", async (HttpContext httpContext, IDownstreamWebApi downstreamWebApi) => +app.MapGet("/weatherforecast", async (HttpContext httpContext, IDownstreamApi downstreamApi) => { httpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi); - using var response = await downstreamWebApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.cs index 28d3caf7546d..d63b3aa1d734 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.cs @@ -23,7 +23,7 @@ .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi() #if (GenerateApi) - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) #endif #if (GenerateGraph) .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi")) @@ -37,7 +37,7 @@ #if (GenerateApi) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")) .EnableTokenAcquisitionToCallDownstreamApi() - .AddDownstreamWebApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) + .AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches(); #else .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAdB2C")); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json index e2b8fc294a06..221421e657b4 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json @@ -1,60 +1,62 @@ { -////#if (IndividualB2CAuth) -///* + ////#if (IndividualB2CAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAdB2C": { -// "Instance": "https:////qualified.domain.name.b2clogin.com/", -// "ClientId": "11111111-1111-1111-11111111111111111", -// "Domain": "qualified.domain.name", -//#if (GenerateApi) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "Scopes": "api-scope", -// "SignUpSignInPolicyId": "MySignUpSignInPolicyId" -// }, -////#elseif (OrganizationalAuth) -///* +For more info see https:////aka.ms/dotnet-template-ms-identity-platform + //*/ + // "AzureAdB2C": { + // "Instance": "https:////qualified.domain.name.b2clogin.com/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "Domain": "qualified.domain.name", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "Scopes": "api-scope", + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform -//*/ -// "AzureAd": { -// "Instance": "https:////login.microsoftonline.com/", -//#if (!SingleOrgAuth) -// "TenantId": "common", -//#else -// "Domain": "qualified.domain.name", -// "TenantId": "22222222-2222-2222-2222-222222222222", -//#endif -// "ClientId": "11111111-1111-1111-11111111111111111", +For more info see https:////aka.ms/dotnet-template-ms-identity-platform + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (!SingleOrgAuth) + // "TenantId": "common", + //#else + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", -//#if (GenerateApiOrGraph) -// "ClientSecret": "secret-from-app-registration", -// "ClientCertificates" : [ -// ], -//#endif -// "Scopes": "api-scope", -// "CallbackPath": "/signin-oidc" -// }, -////#endif -////#if (GenerateApiOrGraph) -// "DownstreamApi": { -// /* -// 'Scopes' contains space separated scopes of the Web API you want to call. This can be: -// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) -// - a scope corresponding to a V1 application (for instance /.default, where is the -// App ID URI of a legacy v1 Web application -// Applications are registered in the https://portal.azure.com portal. -// */ -// "BaseUrl": "[WebApiUrl]", -// "Scopes": "user.read" -// }, -////#endif + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "Scopes": "api-scope", + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", From 534ae4789f394ff429c88d23c36b499eab03f73a Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Thu, 11 May 2023 20:28:27 +0200 Subject: [PATCH 04/17] Update Microsoft.DotNet.Web.ProjectTemplates.csproj --- .../Microsoft.DotNet.Web.ProjectTemplates.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj index b670f813b970..bfa7944a0d62 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj @@ -22,7 +22,7 @@ MicrosoftIdentityWebVersion=$(MicrosoftIdentityWebVersion); MicrosoftIdentityWebMicrosoftGraphVersion=$(MicrosoftIdentityWebMicrosoftGraphVersion); MicrosoftIdentityWebUIVersion=$(MicrosoftIdentityWebUIVersion); - MicrosoftIdentityWebDownstreamApiVersion$(MicrosoftIdentityWebDownstreamApiVersion); + MicrosoftIdentityWebDownstreamApiVersion=$(MicrosoftIdentityWebDownstreamApiVersion); MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion); SystemNetHttpJsonVersion=$(SystemNetHttpJsonVersion); MicrosoftGraphVersion=$(MicrosoftGraphVersion); From 4daf5d7520c6d52b1e40a49eee4f060514de0ad7 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Thu, 11 May 2023 20:46:26 +0200 Subject: [PATCH 05/17] Update WebApi-CSharp.csproj.in --- .../Web.ProjectTemplates/WebApi-CSharp.csproj.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in index f8ecbd7844ab..d0bae3493e4f 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in @@ -18,7 +18,7 @@ - + From d0c109d24252979cc6c9ccf833a4684a70bce701 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 09:23:53 +0200 Subject: [PATCH 06/17] Update WebApi-CSharp.csproj.in --- .../Web.ProjectTemplates/WebApi-CSharp.csproj.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in index d0bae3493e4f..0bfa723c074f 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in @@ -18,7 +18,7 @@ - + From 1490d1bc30e7a3d83b6c27981a7108126b9aba4d Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:34:05 +0200 Subject: [PATCH 07/17] Update appsettings.json --- .../BlazorServerWeb-CSharp/appsettings.json | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json index 4f3327974996..2770ffe960b4 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json @@ -1,67 +1,67 @@ { - ////#if (IndividualB2CAuth) - // "AzureAdB2C": { - // "Instance": "https:////login.microsoftonline.com/tfp/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "CallbackPath": "/signin-oidc", - // "Domain": "qualified.domain.name", - // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", - // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", - // "EditProfilePolicyId": "MyEditProfilePolicyId" - // }, - ////#elseif (OrganizationalAuth) - ///* + ////#if (IndividualB2CAuth) + // "AzureAdB2C": { + // "Instance": "https:////login.microsoftonline.com/tfp/", + // "ClientId": "11111111-1111-1111-11111111111111111", + // "CallbackPath": "/signin-oidc", + // "Domain": "qualified.domain.name", + // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", + //#if (GenerateApi) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", + // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", + // "EditProfilePolicyId": "MyEditProfilePolicyId" + // }, + ////#elseif (OrganizationalAuth) + ///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (MultiOrgAuth) - // "TenantId": "common", - //#elseif (SingleOrgAuth) - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif - ////#if (IndividualLocalAuth) - // "ConnectionStrings": { - //#if (UseLocalDB) - // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" - //#else - // "DefaultConnection": "DataSource=app.db;Cache=Shared" - //#endif - // }, - ////#endif + //*/ + // "AzureAd": { + // "Instance": "https:////login.microsoftonline.com/", + //#if (MultiOrgAuth) + // "TenantId": "common", + //#elseif (SingleOrgAuth) + // "Domain": "qualified.domain.name", + // "TenantId": "22222222-2222-2222-2222-222222222222", + //#endif + // "ClientId": "11111111-1111-1111-11111111111111111", + //#if (GenerateApiOrGraph) + // "ClientSecret": "secret-from-app-registration", + // "ClientCertificates" : [ + // ], + //#endif + // "CallbackPath": "/signin-oidc" + // }, + ////#endif + ////#if (GenerateApiOrGraph) + // "DownstreamApi": { + // /* + // 'Scopes' contains scopes of the Web API you want to call. This can be: + // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) + // - a scope corresponding to a V1 application (for instance /.default, where is the + // App ID URI of a legacy v1 Web application + // Applications are registered in the https://portal.azure.com portal. + // */ + // "BaseUrl": "[WebApiUrl]", + // "Scopes": [ + // "user.read" + // ] + // }, + ////#endif + ////#if (IndividualLocalAuth) + // "ConnectionStrings": { + //#if (UseLocalDB) + // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" + //#else + // "DefaultConnection": "DataSource=app.db;Cache=Shared" + //#endif + // }, + ////#endif "Logging": { "LogLevel": { "Default": "Information", From ccf09207e6c1ac6ec5888f24d85f41b7385ce11d Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:38:15 +0200 Subject: [PATCH 08/17] Update appsettings.json --- .../BlazorServerWeb-CSharp/appsettings.json | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json index 2770ffe960b4..03d1f8518f77 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/appsettings.json @@ -1,67 +1,67 @@ { - ////#if (IndividualB2CAuth) - // "AzureAdB2C": { - // "Instance": "https:////login.microsoftonline.com/tfp/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "CallbackPath": "/signin-oidc", - // "Domain": "qualified.domain.name", - // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", - // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", - // "EditProfilePolicyId": "MyEditProfilePolicyId" - // }, - ////#elseif (OrganizationalAuth) - ///* +////#if (IndividualB2CAuth) +// "AzureAdB2C": { +// "Instance": "https:////login.microsoftonline.com/tfp/", +// "ClientId": "11111111-1111-1111-11111111111111111", +// "CallbackPath": "/signin-oidc", +// "Domain": "qualified.domain.name", +// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", +//#if (GenerateApi) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", +// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", +// "EditProfilePolicyId": "MyEditProfilePolicyId" +// }, +////#elseif (OrganizationalAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (MultiOrgAuth) - // "TenantId": "common", - //#elseif (SingleOrgAuth) - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif - ////#if (IndividualLocalAuth) - // "ConnectionStrings": { - //#if (UseLocalDB) - // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" - //#else - // "DefaultConnection": "DataSource=app.db;Cache=Shared" - //#endif - // }, - ////#endif +//*/ +// "AzureAd": { +// "Instance": "https:////login.microsoftonline.com/", +//#if (MultiOrgAuth) +// "TenantId": "common", +//#elseif (SingleOrgAuth) +// "Domain": "qualified.domain.name", +// "TenantId": "22222222-2222-2222-2222-222222222222", +//#endif +// "ClientId": "11111111-1111-1111-11111111111111111", +//#if (GenerateApiOrGraph) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "CallbackPath": "/signin-oidc" +// }, +////#endif +////#if (GenerateApiOrGraph) +// "DownstreamApi": { +// /* +// 'Scopes' contains scopes of the Web API you want to call. This can be: +// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) +// - a scope corresponding to a V1 application (for instance /.default, where is the +// App ID URI of a legacy v1 Web application +// Applications are registered in the https://portal.azure.com portal. +// */ +// "BaseUrl": "[WebApiUrl]", +// "Scopes": [ +// "user.read" +// ] +// }, +////#endif +////#if (IndividualLocalAuth) +// "ConnectionStrings": { +//#if (UseLocalDB) +// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" +//#else +// "DefaultConnection": "DataSource=app.db;Cache=Shared" +//#endif +// }, +////#endif "Logging": { "LogLevel": { "Default": "Information", From 64a7366647195a7f55da260c3aa0917bd1823f0f Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:45:30 +0200 Subject: [PATCH 09/17] Update appsettings.json --- .../Server/appsettings.json | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json index f2a321b29656..ce564db709e0 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json @@ -1,83 +1,83 @@ { - ////#if (IndividualLocalAuth) - // "ConnectionStrings": { - ////#if (UseLocalDB) - // "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-ComponentsWebAssembly_CSharp.Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" - ////#else - // "DefaultConnection": "DataSource=app.db" - ////#endif - // }, - ////#elseif (IndividualB2CAuth) - ///* +////#if (IndividualLocalAuth) +// "ConnectionStrings": { +////#if (UseLocalDB) +// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-ComponentsWebAssembly_CSharp.Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" +////#else +// "DefaultConnection": "DataSource=app.db" +////#endif +// }, +////#elseif (IndividualB2CAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAdB2C": { - // "Instance": "https:////aadB2CInstance.b2clogin.com/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "Domain": "qualified.domain.name", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "Scopes": "api-scope", - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId" - // }, - ////#elseif (OrganizationalAuth) - ///* +//*/ +// "AzureAdB2C": { +// "Instance": "https:////aadB2CInstance.b2clogin.com/", +// "ClientId": "11111111-1111-1111-11111111111111111", +// "Domain": "qualified.domain.name", +//#if (GenerateApi) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "Scopes": "api-scope", +// "SignUpSignInPolicyId": "MySignUpSignInPolicyId" +// }, +////#elseif (OrganizationalAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (!SingleOrgAuth) - // "TenantId": "common", - //#else - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "Scopes": "api-scope", - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif +//*/ +// "AzureAd": { +// "Instance": "https:////login.microsoftonline.com/", +//#if (!SingleOrgAuth) +// "TenantId": "common", +//#else +// "Domain": "qualified.domain.name", +// "TenantId": "22222222-2222-2222-2222-222222222222", +//#endif +// "ClientId": "11111111-1111-1111-11111111111111111", +//#if (GenerateApiOrGraph) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "Scopes": "api-scope", +// "CallbackPath": "/signin-oidc" +// }, +////#endif +////#if (GenerateApiOrGraph) +// "DownstreamApi": { +// /* +// 'Scopes' contains scopes of the Web API you want to call. This can be: +// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) +// - a scope corresponding to a V1 application (for instance /.default, where is the +// App ID URI of a legacy v1 Web application +// Applications are registered in the https://portal.azure.com portal. +// */ +// "BaseUrl": "[WebApiUrl]", +// "Scopes": [ +// "user.read" +// ] +// }, +////#endif "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, - ////#if (IndividualLocalAuth) - // "IdentityServer": { - // "Clients": { - // "ComponentsWebAssembly_CSharp.Client": { - // "Profile": "IdentityServerSPA" - // } - // } - // }, - ////#endif +////#if (IndividualLocalAuth) +// "IdentityServer": { +// "Clients": { +// "ComponentsWebAssembly_CSharp.Client": { +// "Profile": "IdentityServerSPA" +// } +// } +// }, +////#endif "AllowedHosts": "*" } From f1723a23fc775ff309c54ff1ac7e2f45f140bafb Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:46:57 +0200 Subject: [PATCH 10/17] Update appsettings.json --- .../ComponentsWebAssembly-CSharp/Server/appsettings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json index ce564db709e0..04c6aa7aedfa 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json @@ -11,7 +11,7 @@ ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform +For more info see https:////aka.ms/dotnet-template-ms-identity-platform //*/ // "AzureAdB2C": { // "Instance": "https:////aadB2CInstance.b2clogin.com/", @@ -29,7 +29,7 @@ For more info see https:////aka.ms/dotnet-template-ms-identity-platform ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform +For more info see https:////aka.ms/dotnet-template-ms-identity-platform //*/ // "AzureAd": { // "Instance": "https:////login.microsoftonline.com/", From 2382771aa28640b0d11198166254222c6f92f756 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:50:02 +0200 Subject: [PATCH 11/17] Update appsettings.json --- .../RazorPagesWeb-CSharp/appsettings.json | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json index 5c8f9b352caa..1d8c4ecbe393 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/appsettings.json @@ -1,67 +1,67 @@ { - ////#if (IndividualB2CAuth) - // "AzureAdB2C": { - // "Instance": "https:////login.microsoftonline.com/tfp/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "CallbackPath": "/signin-oidc", - // "Domain": "qualified.domain.name", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", - // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", - // "EditProfilePolicyId": "MyEditProfilePolicyId" - // }, - ////#elseif (OrganizationalAuth) - ///* +////#if (IndividualB2CAuth) +// "AzureAdB2C": { +// "Instance": "https:////login.microsoftonline.com/tfp/", +// "ClientId": "11111111-1111-1111-11111111111111111", +// "CallbackPath": "/signin-oidc", +// "Domain": "qualified.domain.name", +//#if (GenerateApi) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", +// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", +// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", +// "EditProfilePolicyId": "MyEditProfilePolicyId" +// }, +////#elseif (OrganizationalAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (MultiOrgAuth) - // "TenantId": "common", - //#elseif (SingleOrgAuth) - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif - ////#if (IndividualLocalAuth) - // "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;Cache=Shared" - //#endif - // }, - ////#endif +//*/ +// "AzureAd": { +// "Instance": "https:////login.microsoftonline.com/", +//#if (MultiOrgAuth) +// "TenantId": "common", +//#elseif (SingleOrgAuth) +// "Domain": "qualified.domain.name", +// "TenantId": "22222222-2222-2222-2222-222222222222", +//#endif +// "ClientId": "11111111-1111-1111-11111111111111111", +//#if (GenerateApiOrGraph) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "CallbackPath": "/signin-oidc" +// }, +////#endif +////#if (GenerateApiOrGraph) +// "DownstreamApi": { +// /* +// 'Scopes' contains scopes of the Web API you want to call. This can be: +// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) +// - a scope corresponding to a V1 application (for instance /.default, where is the +// App ID URI of a legacy v1 Web application +// Applications are registered in the https://portal.azure.com portal. +// */ +// "BaseUrl": "[WebApiUrl]", +// "Scopes": [ +// "user.read" +// ] +// }, +////#endif +////#if (IndividualLocalAuth) +// "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;Cache=Shared" +//#endif +// }, +////#endif "Logging": { "LogLevel": { "Default": "Information", From ad39a385e306e33a6ae85a6185a16436a2623c78 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:52:38 +0200 Subject: [PATCH 12/17] Update appsettings.json --- .../StarterWeb-CSharp/appsettings.json | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json index 51a8a2d7f02d..b77e611d8915 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json @@ -1,67 +1,67 @@ { - ////#if (IndividualB2CAuth) - // "AzureAdB2C": { - // "Instance": "https:////login.microsoftonline.com/tfp/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "Domain": "qualified.domain.name", - // "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId", - // "ResetPasswordPolicyId": "MyResetPasswordPolicyId", - // "EditProfilePolicyId": "MyEditProfilePolicyId", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "CallbackPath": "/signin-oidc" - // }, - ////#elseif (OrganizationalAuth) - ///* +////#if (IndividualB2CAuth) +// "AzureAdB2C": { +// "Instance": "https:////login.microsoftonline.com/tfp/", +// "ClientId": "11111111-1111-1111-11111111111111111", +// "Domain": "qualified.domain.name", +// "SignedOutCallbackPath": "/signout/MySignUpSignInPolicyId", +// "SignUpSignInPolicyId": "MySignUpSignInPolicyId", +// "ResetPasswordPolicyId": "MyResetPasswordPolicyId", +// "EditProfilePolicyId": "MyEditProfilePolicyId", +//#if (GenerateApi) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "CallbackPath": "/signin-oidc" +// }, +////#elseif (OrganizationalAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (MultiOrgAuth) - // "TenantId": "common", - //#elseif (SingleOrgAuth) - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif - ////#if (IndividualLocalAuth) - // "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;Cache=Shared" - //#endif - // }, - ////#endif +//*/ +// "AzureAd": { +// "Instance": "https:////login.microsoftonline.com/", +//#if (MultiOrgAuth) +// "TenantId": "common", +//#elseif (SingleOrgAuth) +// "Domain": "qualified.domain.name", +// "TenantId": "22222222-2222-2222-2222-222222222222", +//#endif +// "ClientId": "11111111-1111-1111-11111111111111111", +//#if (GenerateApiOrGraph) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "CallbackPath": "/signin-oidc" +// }, +////#endif +////#if (GenerateApiOrGraph) +// "DownstreamApi": { +// /* +// 'Scopes' contains scopes of the Web API you want to call. This can be: +// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) +// - a scope corresponding to a V1 application (for instance /.default, where is the +// App ID URI of a legacy v1 Web application +// Applications are registered in the https://portal.azure.com portal. +// */ +// "BaseUrl": "[WebApiUrl]", +// "Scopes": [ +// "user.read" +// ] +// }, +////#endif +////#if (IndividualLocalAuth) +// "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;Cache=Shared" +//#endif +// }, +////#endif "Logging": { "LogLevel": { "Default": "Information", From 5532e3d71dbc6e98faad48501dd8cb0de1486b61 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:55:41 +0200 Subject: [PATCH 13/17] Update appsettings.json --- .../content/WebApi-CSharp/appsettings.json | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json index 221421e657b4..29f341a8c080 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json @@ -1,62 +1,62 @@ { - ////#if (IndividualB2CAuth) - ///* +////#if (IndividualB2CAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAdB2C": { - // "Instance": "https:////qualified.domain.name.b2clogin.com/", - // "ClientId": "11111111-1111-1111-11111111111111111", - // "Domain": "qualified.domain.name", - //#if (GenerateApi) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "Scopes": "api-scope", - // "SignUpSignInPolicyId": "MySignUpSignInPolicyId" - // }, - ////#elseif (OrganizationalAuth) - ///* +//*/ +// "AzureAdB2C": { +// "Instance": "https:////qualified.domain.name.b2clogin.com/", +// "ClientId": "11111111-1111-1111-11111111111111111", +// "Domain": "qualified.domain.name", +//#if (GenerateApi) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "Scopes": "api-scope", +// "SignUpSignInPolicyId": "MySignUpSignInPolicyId" +// }, +////#elseif (OrganizationalAuth) +///* The following identity settings need to be configured before the project can be successfully executed. For more info see https:////aka.ms/dotnet-template-ms-identity-platform - //*/ - // "AzureAd": { - // "Instance": "https:////login.microsoftonline.com/", - //#if (!SingleOrgAuth) - // "TenantId": "common", - //#else - // "Domain": "qualified.domain.name", - // "TenantId": "22222222-2222-2222-2222-222222222222", - //#endif - // "ClientId": "11111111-1111-1111-11111111111111111", +//*/ +// "AzureAd": { +// "Instance": "https:////login.microsoftonline.com/", +//#if (!SingleOrgAuth) +// "TenantId": "common", +//#else +// "Domain": "qualified.domain.name", +// "TenantId": "22222222-2222-2222-2222-222222222222", +//#endif +// "ClientId": "11111111-1111-1111-11111111111111111", - //#if (GenerateApiOrGraph) - // "ClientSecret": "secret-from-app-registration", - // "ClientCertificates" : [ - // ], - //#endif - // "Scopes": "api-scope", - // "CallbackPath": "/signin-oidc" - // }, - ////#endif - ////#if (GenerateApiOrGraph) - // "DownstreamApi": { - // /* - // 'Scopes' contains scopes of the Web API you want to call. This can be: - // - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) - // - a scope corresponding to a V1 application (for instance /.default, where is the - // App ID URI of a legacy v1 Web application - // Applications are registered in the https://portal.azure.com portal. - // */ - // "BaseUrl": "[WebApiUrl]", - // "Scopes": [ - // "user.read" - // ] - // }, - ////#endif +//#if (GenerateApiOrGraph) +// "ClientSecret": "secret-from-app-registration", +// "ClientCertificates" : [ +// ], +//#endif +// "Scopes": "api-scope", +// "CallbackPath": "/signin-oidc" +// }, +////#endif +////#if (GenerateApiOrGraph) +// "DownstreamApi": { +// /* +// 'Scopes' contains scopes of the Web API you want to call. This can be: +// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user) +// - a scope corresponding to a V1 application (for instance /.default, where is the +// App ID URI of a legacy v1 Web application +// Applications are registered in the https://portal.azure.com portal. +// */ +// "BaseUrl": "[WebApiUrl]", +// "Scopes": [ +// "user.read" +// ] +// }, +////#endif "Logging": { "LogLevel": { "Default": "Information", From 4be971b0cb62ba2a906c67fd89a5662a421b0a8b Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 14:56:45 +0200 Subject: [PATCH 14/17] Update appsettings.json --- .../content/WebApi-CSharp/appsettings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json index 29f341a8c080..674807ffa7d8 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json @@ -3,7 +3,7 @@ ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform +For more info see https:////aka.ms/dotnet-template-ms-identity-platform //*/ // "AzureAdB2C": { // "Instance": "https:////qualified.domain.name.b2clogin.com/", @@ -21,7 +21,7 @@ For more info see https:////aka.ms/dotnet-template-ms-identity-platform ///* The following identity settings need to be configured before the project can be successfully executed. -For more info see https:////aka.ms/dotnet-template-ms-identity-platform +For more info see https:////aka.ms/dotnet-template-ms-identity-platform //*/ // "AzureAd": { // "Instance": "https:////login.microsoftonline.com/", From f5302432031223bc3378a22c0eee1c6240397e43 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Fri, 12 May 2023 19:37:18 +0200 Subject: [PATCH 15/17] Apply suggestions from code review Co-authored-by: Stephen Halter --- .../Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in | 2 +- .../ComponentsWebAssembly-CSharp.Server.csproj.in | 2 +- .../Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in | 2 +- .../Web.ProjectTemplates/StarterWeb-CSharp.csproj.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in index 91c984f41385..d7786a9e09d1 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in @@ -31,7 +31,7 @@ - + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in index ce7e7693a46a..b40abaead722 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in @@ -45,7 +45,7 @@ - + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in index 693f5fe00ef1..bb4de59b14bc 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in @@ -29,7 +29,7 @@ - + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in index 7aa4b869201d..444453017f10 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in @@ -29,7 +29,7 @@ - + From d126a18553a59776502008af31cc961b2471a520 Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Mon, 15 May 2023 13:50:11 +0200 Subject: [PATCH 16/17] Update Program.Main.cs --- .../Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs index 05d80ea12f99..314d3412d3dc 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs @@ -106,7 +106,7 @@ public static void Main(string[] args) { httpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi); - using var response = await downstreamApi.CallWebApiForUserAsync("DownstreamApi").ConfigureAwait(false); + using var response = await downstreamApi.CallApiForUserAsync("DownstreamApi").ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false); From 96180f18ecc9b1dbecb5d45feb15aa879bbd9e5e Mon Sep 17 00:00:00 2001 From: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Date: Mon, 15 May 2023 17:01:31 +0200 Subject: [PATCH 17/17] Update WebApi-CSharp.csproj.in --- .../Web.ProjectTemplates/WebApi-CSharp.csproj.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in index 0bfa723c074f..0e825ca5f248 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in @@ -18,7 +18,7 @@ - +