Interface AccessEvaluator

  • All Known Implementing Classes:
    RequiresRole.Evaluator, SecuredRoute.NotSetAccessEvaluator

    public interface AccessEvaluator
    A AccessEvaluator is the programmatic alternative to expression-based access control. Instantiator.getOrCreate(Class) is used to create an instance of evaluators, so they may be singleton Spring beans or just classes with a public no-args constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean hasAccess​(com.vaadin.flow.router.BeforeEnterEvent beforeEnterEvent, Class<?> targetOrLayout)
      Returns whether the user should be granted access to the navigation target.
    • Method Detail

      • hasAccess

        boolean hasAccess​(com.vaadin.flow.router.BeforeEnterEvent beforeEnterEvent,
                          Class<?> targetOrLayout)
        Returns whether the user should be granted access to the navigation target. The provided class is either the navigation target itself or one of its parent layouts currently being evaluated.

        When access is denied, it's allowed to call the forward or reroute methods on the event.

        VaadinSecurity can be very useful in implementations.

        Parameters:
        beforeEnterEvent - the attempted navigation to be checked for access
        targetOrLayout - the current target or layout class being evaluated
        Returns:
        whether the user should have access to the navigation target