Application parts cleanups
This commit is contained in:
parent
500279ea98
commit
8f42ce8492
|
|
@ -8,15 +8,6 @@
|
||||||
"Exclusions": {
|
"Exclusions": {
|
||||||
"DOC_MISSING": {
|
"DOC_MISSING": {
|
||||||
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll": "This library contains precompiled views."
|
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll": "This library contains precompiled views."
|
||||||
},
|
|
||||||
"ASSEMBLY_DESCRIPTION": {
|
|
||||||
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll": "Enter justification"
|
|
||||||
},
|
|
||||||
"NEUTRAL_RESOURCES_LANGUAGE": {
|
|
||||||
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll": "Enter justification"
|
|
||||||
},
|
|
||||||
"SERVICING_ATTRIBUTE": {
|
|
||||||
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll": "Enter justification"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:59361/",
|
"applicationUrl": "http://localhost:59364/",
|
||||||
"sslPort": 0
|
"sslPort": 44315
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"profiles": {
|
"profiles": {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Authentication
|
namespace Microsoft.AspNetCore.Authentication
|
||||||
{
|
{
|
||||||
|
|
@ -190,23 +191,17 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
|
|
||||||
private static void AddAdditionalMvcApplicationParts(IServiceCollection services)
|
private static void AddAdditionalMvcApplicationParts(IServiceCollection services)
|
||||||
{
|
{
|
||||||
var thisAssembly = typeof(AzureADB2CAuthenticationBuilderExtensions).Assembly;
|
var additionalParts = GetAdditionalParts();
|
||||||
var relatedAssemblies = RelatedAssemblyAttribute.GetRelatedAssemblies(thisAssembly, throwOnError: true);
|
|
||||||
|
|
||||||
var mvcBuilder = services
|
var mvcBuilder = services
|
||||||
.AddMvc()
|
.AddMvc()
|
||||||
.AddRazorPagesOptions(o => o.AllowAreas = true)
|
.AddRazorPagesOptions(o => o.AllowAreas = true)
|
||||||
.ConfigureApplicationPartManager(apm =>
|
.ConfigureApplicationPartManager(apm =>
|
||||||
{
|
{
|
||||||
foreach (var reference in relatedAssemblies)
|
foreach (var part in additionalParts)
|
||||||
{
|
{
|
||||||
var factory = (AzureADB2CPartFactory)ApplicationPartFactory.GetApplicationPartFactory(reference);
|
if (!apm.ApplicationParts.Any(ap => HasSameName(ap.Name, part.Name)))
|
||||||
foreach (var additionalPart in factory.CreateApplicationParts())
|
|
||||||
{
|
{
|
||||||
if (!apm.ApplicationParts.Any(ap => HasSameName(ap.Name, additionalPart.Name)))
|
apm.ApplicationParts.Add(part);
|
||||||
{
|
|
||||||
apm.ApplicationParts.Add(additionalPart);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,5 +210,16 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
|
|
||||||
bool HasSameName(string left, string right) => string.Equals(left, right, StringComparison.Ordinal);
|
bool HasSameName(string left, string right) => string.Equals(left, right, StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<ApplicationPart> GetAdditionalParts()
|
||||||
|
{
|
||||||
|
var thisAssembly = typeof(AzureADB2CAuthenticationBuilderExtensions).Assembly;
|
||||||
|
var relatedAssemblies = RelatedAssemblyAttribute.GetRelatedAssemblies(thisAssembly, throwOnError: true);
|
||||||
|
|
||||||
|
foreach (var reference in relatedAssemblies)
|
||||||
|
{
|
||||||
|
yield return new CompiledRazorAssemblyPart(reference);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reflection;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="ApplicationPartFactory"/> for Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll
|
|
||||||
/// </summary>
|
|
||||||
public abstract class AzureADB2CPartFactory : ApplicationPartFactory
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override IEnumerable<ApplicationPart> GetApplicationParts(Assembly assembly, string context) =>
|
|
||||||
Array.Empty<ApplicationPart>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates the list of <see cref="ApplicationPart"/> for a given application.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The <see cref="ApplicationPart"/> list.</returns>
|
|
||||||
public abstract IEnumerable<ApplicationPart> CreateApplicationParts();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
|
|
||||||
{
|
|
||||||
internal class AzureAdB2CViewsPartFactory : AzureADB2CPartFactory
|
|
||||||
{
|
|
||||||
public override IEnumerable<ApplicationPart> CreateApplicationParts()
|
|
||||||
{
|
|
||||||
yield return new CompiledRazorAssemblyPart(this.GetType().Assembly);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core Azure Active Directory B2C Integration provides components for easily integrating Azure Active Directory B2C authentication within your ASP.NET Core application.</Description>
|
<Description>ASP.NET Core Azure Active Directory B2C Integration provides components for easily integrating Azure Active Directory B2C authentication within your ASP.NET Core application.</Description>
|
||||||
<PrecompiledDescription>Precompiled views assembly for the ASP.NET Core Azure Active Directory B2C Integration package.</PrecompiledDescription>
|
<ViewAssemblyDescription>Precompiled views assembly for the ASP.NET Core Azure Active Directory B2C Integration package.</ViewAssemblyDescription>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<PackageTags>aspnetcore;authentication;AzureADB2C</PackageTags>
|
<PackageTags>aspnetcore;authentication;AzureADB2C</PackageTags>
|
||||||
<RazorCompileOnBuild>true</RazorCompileOnBuild>
|
<RazorCompileOnBuild>true</RazorCompileOnBuild>
|
||||||
<PrecompiledAssemblyTitle Condition=" '$(PrecompiledAssemblyTitle)' == '' ">$(RazorTargetName).dll</PrecompiledAssemblyTitle>
|
<PrecompiledAssemblyTitle Condition=" '$(PrecompiledAssemblyTitle)' == '' ">$(RazorTargetName).dll</PrecompiledAssemblyTitle>
|
||||||
<PreserveCompilationContext>false</PreserveCompilationContext>
|
<PreserveCompilationContext>false</PreserveCompilationContext>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<ProvideApplicationPartFactoryAttributeTypeName>Microsoft.AspNetCore.Authentication.AzureADB2C.UI.AzureAdB2CViewsPartFactory, Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views</ProvideApplicationPartFactoryAttributeTypeName>
|
<EnableDefaultCompiledViewAssemblyLoadBehavior>false</EnableDefaultCompiledViewAssemblyLoadBehavior>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -19,9 +19,22 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<RazorCompile Include="AzureAdB2CViewsPartFactory.cs" />
|
<RazorAssemblyAttribute Include="System.Reflection.AssemblyDescriptionAttribute">
|
||||||
<Compile Remove="AzureAdB2CViewsPartFactory.cs" />
|
<_Parameter1>$(ViewAssemblyDescription)</_Parameter1>
|
||||||
</ItemGroup>
|
</RazorAssemblyAttribute>
|
||||||
|
<RazorAssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(BuildNumber)' != ''">
|
||||||
|
<_Parameter1>BuildNumber</_Parameter1>
|
||||||
|
<_Parameter2>$(BuildNumber)</_Parameter2>
|
||||||
|
</RazorAssemblyAttribute>
|
||||||
|
<RazorAssemblyAttribute Include="System.Resources.NeutralResourcesLanguageAttribute" Condition="'$(NeutralLanguage)' != '' and '$(GenerateNeutralResourcesLanguageAttribute)' == 'true'">
|
||||||
|
<_Parameter1>$(NeutralLanguage)</_Parameter1>
|
||||||
|
</RazorAssemblyAttribute>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<RazorCompile Include="$(GeneratedCommitHashAttributeFile)" />
|
||||||
|
<RazorCompile Include="$(GeneratedInternalAspNetCoreAttributeFile)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -3,5 +3,4 @@
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Views.dll, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
|
||||||
Loading…
Reference in New Issue