code: private void redirectToAccessDeniedView(FacesContext context, UIViewRoot viewRoot) {
          // If a user has already done a redirect and rendered the response (possibly in an observer) we cannot do this output
          final PhaseId currentPhase = context.getCurrentPhaseId();
          if (!context.getResponseComplete() && !PhaseId.RENDER_RESPONSE.equals(currentPhase)) {
              AccessDeniedView accessDeniedView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), AccessDeniedView.class);
              if (accessDeniedView == null || accessDeniedView.value() == null || accessDeniedView.value().isEmpty()) {
                  log.warn("No AccessDeniedView is configured, returning 401 response (access denied). Please configure an AccessDeniedView in the ViewConfig.");
                  context.getExternalContext().setResponseStatus(401);
                  context.responseComplete();
                  return;
              }
              String accessDeniedViewId = accessDeniedView.value();
              log.debugf("Redirecting to configured AccessDenied %s", accessDeniedViewId);
              NavigationHandler navHandler = context.getApplication().getNavigationHandler();
              navHandler.handleNavigation(context, "", accessDeniedViewId);
              context.renderResponse();
          }
      }
docs: Perform the navigation to the @AccessDeniedView.  If not @AccessDeniedView is defined, return a 401 response
  
  @param context
  @param viewRoot