AuthorizeView not working with csla Blazor #2350
Replies: 5 comments 1 reply
-
Most Probably, your Businessbase is missing this section
|
Beta Was this translation helpful? Give feedback.
-
I am still having issues with the CslaPolicy and HasPermission attribute, they are all failing. in Blazor. I did check that the rules are in my bo but it does not help. Has anyone else run into this issue? |
Beta Was this translation helpful? Give feedback.
-
Did you ever figure this out. I am having the same issue and posted a questions here. As long as I remain on CSLA version 5.4.1 I do not have the issue. When I upgrade I run into this problem. Please let me know if you found the culprit. Thanks |
Beta Was this translation helpful? Give feedback.
-
There are a couple types that need to be registered with DI on startup to support CSLA claims - I wonder if they aren't being registered somehow? services.AddTransient<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
services.AddTransient<IAuthorizationHandler, CslaPermissionsHandler>(); |
Beta Was this translation helpful? Give feedback.
-
@Brannos1970 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The Blazor application I am working I am getting the following error:
System.InvalidOperationException: The AuthorizationPolicy named: 'Csla:CreateObject|Scheduler.Shared.Calendar, Scheduler.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' was not found.
at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider policyProvider, IEnumerable`1 authorizeData)
at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.IsAuthorizedAsync(ClaimsPrincipal user)
at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit '_igQWSzj1J1KBO0ksLaCBerxJMfANbt2U87887LVh04'.
In the configure services in startup I do have AddCsla with Blazor server support set.
The razor page code failing is
<AuthorizeView Policy="@(CslaPolicy.GetPolicy(AuthorizationActions.CreateObject, typeof(Scheduler.Shared.Calendar)))"> <RadzenButton Icon="add_circle_outline" style="margin-bottom: 10px" Text="@Localizer["Add"]" ="@Button0Add" /> </AuthorizeView>
I checked my business object rules to ensure I did not have any conflicts or issues.
I can change the authorize view to use roles or custom policies, anything but Csla, and it works fine.
I need help figuring out if I missed something or if this is an issue with Csla Blazor 5.4.2.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions