Update identity web templates (#25834)

* Update identity web templates

* Do not generate scopeRequiredByApi if not needed
This commit is contained in:
John Luo 2020-09-14 07:58:03 -07:00 committed by GitHub
parent 4d5b3159d8
commit 472e8297a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 4 deletions

View File

@ -165,7 +165,6 @@ and are generated based on the last package release.
<LatestPackageReference Include="MessagePack" />
<LatestPackageReference Include="MessagePackAnalyzer" />
<LatestPackageReference Include="Microsoft.Data.SqlClient" />
<LatestPackageReference Include="Microsoft.Identity.Web.UI" />
<LatestPackageReference Include="Mono.Cecil" />
<LatestPackageReference Include="Moq" />
<LatestPackageReference Include="Newtonsoft.Json.Bson" />

View File

@ -231,8 +231,9 @@
<IdentityServer4StoragePackageVersion>4.0.4</IdentityServer4StoragePackageVersion>
<IdentityServer4EntityFrameworkStoragePackageVersion>4.0.4</IdentityServer4EntityFrameworkStoragePackageVersion>
<MessagePackPackageVersion>2.1.90</MessagePackPackageVersion>
<MicrosoftIdentityWebPackageVersion>0.3.1-preview</MicrosoftIdentityWebPackageVersion>
<MicrosoftIdentityWebUIPackageVersion>0.3.1-preview</MicrosoftIdentityWebUIPackageVersion>
<MicrosoftIdentityWebPackageVersion>0.4.0-preview</MicrosoftIdentityWebPackageVersion>
<MicrosoftIdentityWebMicrosoftGraphPackageVersion>0.4.0-preview</MicrosoftIdentityWebMicrosoftGraphPackageVersion>
<MicrosoftIdentityWebUIPackageVersion>0.4.0-preview</MicrosoftIdentityWebUIPackageVersion>
<MessagePackAnalyzerPackageVersion>$(MessagePackPackageVersion)</MessagePackAnalyzerPackageVersion>
<MoqPackageVersion>4.10.0</MoqPackageVersion>
<MonoCecilPackageVersion>0.11.2</MonoCecilPackageVersion>

View File

@ -24,6 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
</ItemGroup>

View File

@ -39,6 +39,7 @@
<!--#if (OrganizationalAuth || IndividualB2CAuth) -->
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" />
</ItemGroup>
<!--#endif -->

View File

@ -19,6 +19,7 @@
MicrosoftExtensionsHostingPackageVersion=$(MicrosoftExtensionsHostingPackageVersion);
MicrosoftExtensionsHttpPackageVersion=$(MicrosoftExtensionsHttpPackageVersion);
MicrosoftIdentityWebPackageVersion=$(MicrosoftIdentityWebPackageVersion);
MicrosoftIdentityWebMicrosoftGraphPackageVersion=$(MicrosoftIdentityWebMicrosoftGraphPackageVersion);
MicrosoftIdentityWebUIPackageVersion=$(MicrosoftIdentityWebUIPackageVersion);
MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion);
SystemNetHttpJsonPackageVersion=$(SystemNetHttpJsonPackageVersion);

View File

@ -24,6 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
</ItemGroup>
<!--#endif -->

View File

@ -24,6 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIPackageVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
</ItemGroup>
<!--#endif -->

View File

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebPackageVersion}" Condition="'$(OrganizationalAuth)' == 'True' OR '$(IndividualB2CAuth)' == 'True'"/>
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphPackageVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
<PackageReference Include="Swashbuckle.AspNetCore" Version="${SwashbuckleAspNetCorePackageVersion}" Condition="'$(EnableOpenAPI)' == 'True'" />
</ItemGroup>
<!--#endif -->

View File

@ -36,9 +36,11 @@ namespace ComponentsWebAssembly_CSharp.Server.Controllers
};
private readonly ILogger<WeatherForecastController> _logger;
#if (OrganizationalAuth || IndividualB2CAuth)
// The Web API will only accept tokens 1) for users, and 2) having the "api-scope" scope for this API
static readonly string[] scopeRequiredByApi = new string[] { "api-scope" };
#endif
#if (GenerateApi)
private readonly IDownstreamWebApi _downstreamWebApi;

View File

@ -104,7 +104,7 @@
"replaces": "api-scope",
"defaultValue": "access_as_user",
"description": "The API scope the client needs to request to provision an access token. (use with IndividualB2C, SingleOrg)."
},
},
"TenantId": {
"type": "parameter",
"datatype": "string",

View File

@ -35,9 +35,11 @@ namespace Company.WebApplication1.Controllers
};
private readonly ILogger<WeatherForecastController> _logger;
#if (OrganizationalAuth || IndividualB2CAuth)
// The Web API will only accept tokens 1) for users, and 2) having the "api-scope" scope for this API
static readonly string[] scopeRequiredByApi = new string[] { "api-scope" };
#endif
#if (GenerateApi)
private readonly IDownstreamWebApi _downstreamWebApi;