|
3 | 3 |
|
4 | 4 | namespace CodeBeam.UltimateAuth.Client.Blazor; |
5 | 5 |
|
| 6 | +/// <summary> |
| 7 | +/// Provides the root Blazor integration component for UltimateAuth. |
| 8 | +/// </summary> |
| 9 | +/// <remarks> |
| 10 | +/// <para> |
| 11 | +/// <see cref="UAuthApp"/> initializes the UltimateAuth client runtime, |
| 12 | +/// exposes the current <see cref="UAuthState"/> as a cascading value, |
| 13 | +/// coordinates the authenticated session lifecycle, and optionally provides |
| 14 | +/// the application's Blazor router. |
| 15 | +/// </para> |
| 16 | +/// <para> |
| 17 | +/// Applications using UltimateAuth Blazor components should normally place |
| 18 | +/// their application content within this component. |
| 19 | +/// </para> |
| 20 | +/// <para> |
| 21 | +/// Client-side authentication state is intended for UI behavior only and |
| 22 | +/// does not constitute a security boundary. Authorization of protected |
| 23 | +/// resources must always be enforced by the server. |
| 24 | +/// </para> |
| 25 | +/// </remarks> |
6 | 26 | public partial class UAuthApp |
7 | 27 | { |
8 | 28 | private bool _initialized; |
9 | 29 | private bool _coordinatorStarted; |
10 | 30 |
|
| 31 | + /// <summary> |
| 32 | + /// Gets or sets the application content rendered within the UltimateAuth context. |
| 33 | + /// </summary> |
11 | 34 | [Parameter] |
12 | 35 | public RenderFragment? ChildContent { get; set; } |
13 | 36 |
|
| 37 | + /// <summary> |
| 38 | + /// Gets or sets the content rendered by the built-in router when the current user is not authorized to access a route. |
| 39 | + /// </summary> |
| 40 | + /// <remarks> |
| 41 | + /// This parameter is used only when <see cref="UseBuiltInRouter"/> is enabled. |
| 42 | + /// </remarks> |
14 | 43 | [Parameter] |
15 | 44 | public RenderFragment? NotAuthorized { get; set; } |
16 | 45 |
|
| 46 | + /// <summary> |
| 47 | + /// Gets or sets whether <see cref="UAuthApp"/> should provide the application's Blazor router. |
| 48 | + /// </summary> |
| 49 | + /// <remarks> |
| 50 | + /// Set this to <see langword="false"/> when the application provides its own router. |
| 51 | + /// </remarks> |
17 | 52 | [Parameter] |
18 | 53 | public bool UseBuiltInRouter { get; set; } |
19 | 54 |
|
| 55 | + /// <summary> |
| 56 | + /// Gets or sets whether UltimateAuth client routes are included in the assemblies searched by the built-in router. |
| 57 | + /// </summary> |
| 58 | + /// <remarks> |
| 59 | + /// The default value is <see langword="true"/>. |
| 60 | + /// </remarks> |
20 | 61 | [Parameter] |
21 | 62 | public bool UseUAuthClientRoutes { get; set; } = true; |
22 | 63 |
|
| 64 | + /// <summary> |
| 65 | + /// Gets or sets the assembly containing the application's routable components. |
| 66 | + /// </summary> |
| 67 | + /// <remarks> |
| 68 | + /// This value is used by the built-in router. |
| 69 | + /// </remarks> |
23 | 70 | [Parameter] |
24 | 71 | public Assembly? AppAssembly { get; set; } |
25 | 72 |
|
| 73 | + /// <summary> |
| 74 | + /// Gets or sets additional assemblies that should be searched for routable components. |
| 75 | + /// </summary> |
| 76 | + /// <remarks> |
| 77 | + /// When <see cref="UseUAuthClientRoutes"/> is enabled, the UltimateAuth |
| 78 | + /// Blazor client assemblies are added to this set automatically. |
| 79 | + /// </remarks> |
26 | 80 | [Parameter] |
27 | 81 | public IEnumerable<Assembly>? AdditionalAssemblies { get; set; } |
28 | 82 |
|
| 83 | + /// <summary> |
| 84 | + /// Gets or sets the default layout used by the built-in |
| 85 | + /// <see cref="Microsoft.AspNetCore.Components.Authorization.AuthorizeRouteView"/>. |
| 86 | + /// </summary> |
29 | 87 | [Parameter] |
30 | 88 | public Type? DefaultLayout { get; set; } |
31 | 89 |
|
| 90 | + /// <summary> |
| 91 | + /// Gets or sets the CSS selector used by Blazor's focus-on-navigation behavior. |
| 92 | + /// </summary> |
| 93 | + /// <remarks> |
| 94 | + /// The default value is <c>h1</c>. |
| 95 | + /// </remarks> |
32 | 96 | [Parameter] |
33 | 97 | public string? FocusSelector { get; set; } = "h1"; |
34 | 98 |
|
| 99 | + /// <summary> |
| 100 | + /// Gets or sets how UltimateAuth state changes affect component rendering. |
| 101 | + /// </summary> |
| 102 | + /// <remarks> |
| 103 | + /// The default value is <see cref="UAuthRenderMode.Manual"/>. |
| 104 | + /// </remarks> |
35 | 105 | [Parameter] |
36 | 106 | public UAuthRenderMode RenderMode { get; set; } = UAuthRenderMode.Manual; |
37 | 107 |
|
| 108 | + /// <summary> |
| 109 | + /// Gets or sets the callback invoked when the session coordinator determines that reauthentication is required. |
| 110 | + /// </summary> |
38 | 111 | [Parameter] |
39 | 112 | public EventCallback OnReauthRequired { get; set; } |
40 | 113 |
|
@@ -81,6 +154,7 @@ private void OnStateChanged(UAuthStateChangeReason reason) |
81 | 154 | _ = InvokeAsync(async () => |
82 | 155 | { |
83 | 156 | await Coordinator.StartAsync(); |
| 157 | + _coordinatorStarted = true; |
84 | 158 | }); |
85 | 159 | } |
86 | 160 |
|
|
0 commit comments