'Forbidden navigation the user does not have the required authorizations'

How do I handle this error ? Instead of showing this, I want to let user know they do not have access to it by

  1. Showing a notification
  2. Disable the components based on the role so that user cannot click on it

Don’t use the allowed roles annotation on the view and do your own checks or use a “common” role all authorized users have for the view and do your custom checks afterwards to make sure the view is safe by default

I thought this would help

public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {

        if (!authContext.isAuthenticated()) {
            ErrorNotification.show("You do not have access to view this page");

But this is not working

The annotation on the view is checked first

yep, that’s how it is working

is there a way to handle this error globally ?

Any example you know how to handle this ?

I’m rolling my own security implementation which I’m probably not allowed to share