hydrostack / hydro

Hydro brings stateful and reactive components to ASP.NET Core without writing JavaScript
https://usehydro.dev
MIT License
693 stars 16 forks source link

Redirect to Error Page on Authorisation Failure #70

Open StuartFerguson opened 1 month ago

StuartFerguson commented 1 month ago

I have built my own version of the IHydroAuthorizationFilter and attached to to my page which now doesn't render as per the documentation.

What I was wondering though is if there is any way of redirecting the user to a "Permission Denied" page in the application rather than just showing an empty page to enhance the user experience.

Thanks In Advance,

Stuart Ferguson

kjeske commented 1 month ago

For now there is no way to change that, but probably Hydro should have a way to specify a custom default component to render in such cases, like:

services.AddHydro(options =>
{
    options.AuthorizationFallbackComponent = typeof(NotAuthorized);
});