Varied Messages for Unauthorized in AuthorizeRouteView for a specific authorization policy/role
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
In a blazor server application, I can obviously customized a default unauthorized message globally in App.razor as follows:
````
//App.razor
...
You are not authorized. Please talk to John Doe the Administrator about this if needed.
John Doe knows all and makes all the decisions.
...
````
This is nice in a simple application, as it gives a hint what users should do when they are not authorized to do what is supposed to be done.
However, in a large or complex organization where business along with relevant permissions are managed seperately, John Doe the administrator may not be able to answer all the user queries or make a decision on the permissions.
As far as I know, to achieve the goal of letting a rejected user to know what to do exactly, I have to handle unauthorized requests in each razor page repeatedly.
### Describe the solution you'd like
I propose extending AuthorizeRouteView to be capable to handling differrent reasons for authorization failure:
````
//App.razor
...
You are not authorized. Please talk to Joshua the Financial Manager about this if needed.
You are not authorized. Please talk to Rick the Facility Manager about this if needed.
...
You are not authorized. Please talk to John Doe the Administrator about whom you should turn to.
Tell John Doe what is stopping you and he will point you to someone.
...
````
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.