diff --git a/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor b/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor index eb5c93b6dee4..c5ee6a53e20a 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor +++ b/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor @@ -1,5 +1,5 @@ - + Sorry, there's nothing at this address. - + diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs index a4d8a9c9bede..e5200e14a5b9 100644 --- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -301,9 +301,9 @@ public partial class PageDisplay : Microsoft.AspNetCore.Components.IComponent { public PageDisplay() { } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] public System.Type Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] @@ -651,11 +651,11 @@ public Router() { } [Microsoft.AspNetCore.Components.ParameterAttribute] public System.Reflection.Assembly AppAssembly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotFoundContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotFound { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public void Dispose() { } System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; } diff --git a/src/Components/Components/src/Auth/AuthorizeViewCore.cs b/src/Components/Components/src/Auth/AuthorizeViewCore.cs index 8581e6fb6d93..8c60078184f8 100644 --- a/src/Components/Components/src/Auth/AuthorizeViewCore.cs +++ b/src/Components/Components/src/Auth/AuthorizeViewCore.cs @@ -58,8 +58,8 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) } else if (isAuthorized) { - var authorizedContent = Authorized ?? ChildContent; - builder.AddContent(1, authorizedContent?.Invoke(currentAuthenticationState)); + var authorized = Authorized ?? ChildContent; + builder.AddContent(1, authorized?.Invoke(currentAuthenticationState)); } else { diff --git a/src/Components/Components/src/PageDisplay.cs b/src/Components/Components/src/PageDisplay.cs index 61abc706978a..14df824d1393 100644 --- a/src/Components/Components/src/PageDisplay.cs +++ b/src/Components/Components/src/PageDisplay.cs @@ -36,13 +36,13 @@ public class PageDisplay : IComponent /// The content that will be displayed if the user is not authorized. /// [Parameter] - public RenderFragment NotAuthorizedContent { get; set; } + public RenderFragment NotAuthorized { get; set; } /// /// The content that will be displayed while asynchronous authorization is in progress. /// [Parameter] - public RenderFragment AuthorizingContent { get; set; } + public RenderFragment Authorizing { get; set; } /// public void Attach(RenderHandle renderHandle) @@ -109,14 +109,14 @@ private RenderFragment WrapInAuthorizeViewCore(RenderFragment pageFragment) } // Some authorization data exists, so we do need to wrap the fragment - RenderFragment authorizedContent = context => pageFragment; + RenderFragment authorized = context => pageFragment; return builder => { builder.OpenComponent(0); builder.AddAttribute(1, nameof(AuthorizeViewWithSuppliedData.AuthorizeDataParam), authorizeData); - builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorizedContent); - builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorizedContent ?? DefaultNotAuthorizedContent); - builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), AuthorizingContent); + builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorized); + builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorized ?? DefaultNotAuthorized); + builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), Authorizing); builder.CloseComponent(); }; } @@ -133,7 +133,7 @@ private class AuthorizeViewWithSuppliedData : AuthorizeViewCore // There has to be some default content. If we render blank by default, developers // will find it hard to guess why their UI isn't appearing. - private static RenderFragment DefaultNotAuthorizedContent(AuthenticationState authenticationState) + private static RenderFragment DefaultNotAuthorized(AuthenticationState authenticationState) => builder => builder.AddContent(0, "Not authorized"); } } diff --git a/src/Components/Components/src/Routing/Router.cs b/src/Components/Components/src/Routing/Router.cs index c1459063e731..503fd5bd96d4 100644 --- a/src/Components/Components/src/Routing/Router.cs +++ b/src/Components/Components/src/Routing/Router.cs @@ -41,17 +41,17 @@ public class Router : IComponent, IHandleAfterRender, IDisposable /// /// Gets or sets the type of the component that should be used as a fallback when no match is found for the requested route. /// - [Parameter] public RenderFragment NotFoundContent { get; set; } + [Parameter] public RenderFragment NotFound { get; set; } /// /// The content that will be displayed if the user is not authorized. /// - [Parameter] public RenderFragment NotAuthorizedContent { get; set; } + [Parameter] public RenderFragment NotAuthorized { get; set; } /// /// The content that will be displayed while asynchronous authorization is in progress. /// - [Parameter] public RenderFragment AuthorizingContent { get; set; } + [Parameter] public RenderFragment Authorizing { get; set; } private RouteTable Routes { get; set; } @@ -94,8 +94,8 @@ protected virtual void Render(RenderTreeBuilder builder, Type handler, IDictiona builder.OpenComponent(0, typeof(PageDisplay)); builder.AddAttribute(1, nameof(PageDisplay.Page), handler); builder.AddAttribute(2, nameof(PageDisplay.PageParameters), parameters); - builder.AddAttribute(3, nameof(PageDisplay.NotAuthorizedContent), NotAuthorizedContent); - builder.AddAttribute(4, nameof(PageDisplay.AuthorizingContent), AuthorizingContent); + builder.AddAttribute(3, nameof(PageDisplay.NotAuthorized), NotAuthorized); + builder.AddAttribute(4, nameof(PageDisplay.Authorizing), Authorizing); builder.CloseComponent(); } @@ -120,14 +120,14 @@ private void Refresh(bool isNavigationIntercepted) } else { - if (!isNavigationIntercepted && NotFoundContent != null) + if (!isNavigationIntercepted && NotFound != null) { - Log.DisplayingNotFoundContent(_logger, locationPath, _baseUri); + Log.DisplayingNotFound(_logger, locationPath, _baseUri); // We did not find a Component that matches the route. - // Only show the NotFoundContent if the application developer programatically got us here i.e we did not + // Only show the NotFound if the application developer programatically got us here i.e we did not // intercept the navigation. In all other cases, force a browser navigation since this could be non-Blazor content. - _renderHandle.Render(NotFoundContent); + _renderHandle.Render(NotFound); } else { @@ -159,8 +159,8 @@ Task IHandleAfterRender.OnAfterRenderAsync() private static class Log { - private static readonly Action _displayingNotFoundContent = - LoggerMessage.Define(LogLevel.Debug, new EventId(1, "DisplayingNotFoundContent"), $"Displaying {nameof(NotFoundContent)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route"); + private static readonly Action _displayingNotFound = + LoggerMessage.Define(LogLevel.Debug, new EventId(1, "DisplayingNotFound"), $"Displaying {nameof(NotFound)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route"); private static readonly Action _navigatingToComponent = LoggerMessage.Define(LogLevel.Debug, new EventId(2, "NavigatingToComponent"), "Navigating to component {ComponentType} in response to path '{Path}' with base URI '{BaseUri}'"); @@ -168,9 +168,9 @@ private static class Log private static readonly Action _navigatingToExternalUri = LoggerMessage.Define(LogLevel.Debug, new EventId(3, "NavigatingToExternalUri"), "Navigating to non-component URI '{ExternalUri}' in response to path '{Path}' with base URI '{BaseUri}'"); - internal static void DisplayingNotFoundContent(ILogger logger, string path, string baseUri) + internal static void DisplayingNotFound(ILogger logger, string path, string baseUri) { - _displayingNotFoundContent(logger, path, baseUri, null); + _displayingNotFound(logger, path, baseUri, null); } internal static void NavigatingToComponent(ILogger logger, Type componentType, string path, string baseUri) diff --git a/src/Components/Components/test/Auth/AuthorizeViewTest.cs b/src/Components/Components/test/Auth/AuthorizeViewTest.cs index 07633ea9e4ea..848e68e815e1 100644 --- a/src/Components/Components/test/Auth/AuthorizeViewTest.cs +++ b/src/Components/Components/test/Auth/AuthorizeViewTest.cs @@ -53,13 +53,13 @@ public void RendersNothingIfNotAuthorized() } [Fact] - public void RendersNotAuthorizedContentIfNotAuthorized() + public void RendersNotAuthorizedIfNotAuthorized() { // Arrange var authorizationService = new TestAuthorizationService(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - notAuthorizedContent: + notAuthorized: context => builder => builder.AddContent(0, $"You are not authorized, even though we know you are {context.User.Identity.Name}")); rootComponent.AuthenticationState = CreateAuthenticationState("Nellie"); @@ -88,7 +88,7 @@ public void RendersNotAuthorizedContentIfNotAuthorized() } [Fact] - public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedContentProvided() + public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedProvided() { // Arrange var authorizationService = new TestAuthorizationService(); @@ -152,14 +152,14 @@ public void RendersChildContentIfAuthorized() } [Fact] - public void RendersAuthorizedContentIfAuthorized() + public void RendersAuthorizedIfAuthorized() { // Arrange var authorizationService = new TestAuthorizationService(); authorizationService.NextResult = AuthorizationResult.Success(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - authorizedContent: context => builder => + authorized: context => builder => builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}")); rootComponent.AuthenticationState = CreateAuthenticationState("Nellie"); @@ -235,13 +235,13 @@ public void RespondsToChangeInAuthorizationState() } [Fact] - public void ThrowsIfBothChildContentAndAuthorizedContentProvided() + public void ThrowsIfBothChildContentAndAuthorizedProvided() { // Arrange var authorizationService = new TestAuthorizationService(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - authorizedContent: context => builder => { }, + authorized: context => builder => { }, childContent: context => builder => { }); // Act/Assert @@ -260,7 +260,7 @@ public void RendersNothingUntilAuthorizationCompleted() var renderer = CreateTestRenderer(authorizationService); renderer.OnUpdateDisplayComplete = () => { @event.Set(); }; var rootComponent = WrapInAuthorizeView( - notAuthorizedContent: + notAuthorized: context => builder => builder.AddContent(0, "You are not authorized")); var authTcs = new TaskCompletionSource(); rootComponent.AuthenticationState = authTcs.Task; @@ -293,7 +293,7 @@ public void RendersNothingUntilAuthorizationCompleted() } [Fact] - public void RendersAuthorizingContentUntilAuthorizationCompleted() + public void RendersAuthorizingUntilAuthorizationCompleted() { // Arrange var @event = new ManualResetEventSlim(); @@ -302,8 +302,8 @@ public void RendersAuthorizingContentUntilAuthorizationCompleted() var renderer = CreateTestRenderer(authorizationService); renderer.OnUpdateDisplayComplete = () => { @event.Set(); }; var rootComponent = WrapInAuthorizeView( - authorizingContent: builder => builder.AddContent(0, "Auth pending..."), - authorizedContent: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!")); + authorizing: builder => builder.AddContent(0, "Auth pending..."), + authorized: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!")); var authTcs = new TaskCompletionSource(); rootComponent.AuthenticationState = authTcs.Task; @@ -447,9 +447,9 @@ public void RejectsNonemptyScheme() private static TestAuthStateProviderComponent WrapInAuthorizeView( RenderFragment childContent = null, - RenderFragment authorizedContent = null, - RenderFragment notAuthorizedContent = null, - RenderFragment authorizingContent = null, + RenderFragment authorized = null, + RenderFragment notAuthorized = null, + RenderFragment authorizing = null, string policy = null, string roles = null, object resource = null) @@ -458,9 +458,9 @@ private static TestAuthStateProviderComponent WrapInAuthorizeView( { builder.OpenComponent(0); builder.AddAttribute(1, nameof(AuthorizeView.ChildContent), childContent); - builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorizedContent); - builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorizedContent); - builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizingContent); + builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorized); + builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorized); + builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizing); builder.AddAttribute(5, nameof(AuthorizeView.Policy), policy); builder.AddAttribute(6, nameof(AuthorizeView.Roles), roles); builder.AddAttribute(7, nameof(AuthorizeView.Resource), resource); diff --git a/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor b/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor index 73a2b6260d44..d4d5cf8edb9a 100644 --- a/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor +++ b/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor @@ -10,12 +10,12 @@ - Authorizing... - + Authorizing... + Sorry, @(context.User.Identity.Name ?? "anonymous"), you're not authorized. - + diff --git a/src/Components/test/testassets/BasicTestApp/Index.razor b/src/Components/test/testassets/BasicTestApp/Index.razor index df71e0cb93b4..f024f70c3c53 100644 --- a/src/Components/test/testassets/BasicTestApp/Index.razor +++ b/src/Components/test/testassets/BasicTestApp/Index.razor @@ -58,7 +58,6 @@ Render fragment renderer Reordering focus retention Router - Router without NotFoundContent UriHelper Test SVG SVG with child component diff --git a/src/Components/test/testassets/BasicTestApp/RouterTest/TestRouter.razor b/src/Components/test/testassets/BasicTestApp/RouterTest/TestRouter.razor index 8edad0252148..3dbc49bce3ed 100644 --- a/src/Components/test/testassets/BasicTestApp/RouterTest/TestRouter.razor +++ b/src/Components/test/testassets/BasicTestApp/RouterTest/TestRouter.razor @@ -1,6 +1,6 @@ @using Microsoft.AspNetCore.Components.Routing - + Oops, that component wasn't found! - + diff --git a/src/Mvc/test/WebSites/BasicWebSite/RazorComponents/RouterContainer.razor b/src/Mvc/test/WebSites/BasicWebSite/RazorComponents/RouterContainer.razor index 9adb768cb877..20d8ef299147 100644 --- a/src/Mvc/test/WebSites/BasicWebSite/RazorComponents/RouterContainer.razor +++ b/src/Mvc/test/WebSites/BasicWebSite/RazorComponents/RouterContainer.razor @@ -1,7 +1,7 @@ @using Microsoft.AspNetCore.Components.Routing Router component - + Route not found - + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/App.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/App.razor index b913345932f0..52dc3c98d91b 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/App.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/App.razor @@ -1,7 +1,7 @@ - + Sorry, there's nothing at this address. - +
Sorry, there's nothing at this address.
Route not found