AuthorizeRouteView: Add capability to include additional redirects
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
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.
I am using the AuthorizeRouteView to serve my routes and redirect to a login page if the user is not authenticated. However, I want to include an additional rule that certain pages (marked by a custom attribute) require the user to have set a certain metadata value, and if they have not, to redirect them to a page where they can set that value. The problem is, once authorization is confirmed, there is no place to add additional redirects, as the page is simply loaded. AuthorizeRouteView only takes child content for `NotAuthorized` and `Authorizing`, but this doesn't apply.
### Describe the solution you'd like
I would like to be able to specify an `AfterAuthorized` delegate or RenderFragment that runs immediately before the route is processed. Something like this:
```razor
```
Right now, my solution is to make my own subclass of RouteView that reimplements AuthorizeRouteView and does the thing that I want it to do, but AuthorizeRouteView relies on a lot of internal and/or sealed infrastructure, so it's difficult to ensure I've re-implemented everything correctly.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.