Interface AccessEvaluator

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

    public interface AccessEvaluator
    An AccessEvaluator is the programmatic, more flexible alternative to expression-based access control for routes and endpoints.

    Depending on the context, access evaluators are instantiated in different ways:

    • Where a UI is available (which is the case for routes), Instantiator.getOrCreate(Class) will be used. I.e. the evaluator either needs to be available as a Spring bean or it requires a public no-args constructor.
    • Otherwise (for endpoints) the evaluator is directly requested from the ApplicationContext and therefore needs to be available as a Spring bean.
    • Method Detail

      • hasAccess

        boolean hasAccess​(AccessContext accessContext)
        Returns whether access should be granted based on the given context.

        VaadinSecurity can be used in implementations.

        Parameters:
        accessContext - the access context
        Returns:
        whether access should be granted