Class SpringNavigationAccessControl

java.lang.Object
com.vaadin.flow.server.auth.NavigationAccessControl
com.vaadin.flow.spring.security.SpringNavigationAccessControl
All Implemented Interfaces:
com.vaadin.flow.router.BeforeEnterListener, com.vaadin.flow.router.internal.BeforeEnterHandler, Serializable

public class SpringNavigationAccessControl extends com.vaadin.flow.server.auth.NavigationAccessControl
A Spring specific navigation access control that falls back to Spring mechanisms for user retrieval and role checking, when the generic mechanisms do not work.

In Spring Boot application, a SpringNavigationAccessControl is provided by default, but its behavior can be configured by defining a NavigationAccessControlConfigurer bean.

See Also:
  • Field Summary

    Fields inherited from class com.vaadin.flow.server.auth.NavigationAccessControl

    SESSION_STORED_REDIRECT, SESSION_STORED_REDIRECT_ABSOLUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new instance with the default view annotation checker and decision resolver.
    SpringNavigationAccessControl(Collection<com.vaadin.flow.server.auth.NavigationAccessChecker> checkerList, com.vaadin.flow.server.auth.AccessCheckDecisionResolver decisionResolver)
    Create a new instance with given checkers and decision resolver.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Principal
    getPrincipal(com.vaadin.flow.server.VaadinRequest request)
     
    protected Predicate<String>
    getRolesChecker(com.vaadin.flow.server.VaadinRequest request)
     

    Methods inherited from class com.vaadin.flow.server.auth.NavigationAccessControl

    beforeEnter, checkAccess, createNavigationContext, getAccessDeniedException, getLoginUrl, getLoginView, getRequestURL, hasAccessChecker, isEnabled, setEnabled, setLoginView, setLoginView

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpringNavigationAccessControl

      public SpringNavigationAccessControl()
      Create a new instance with the default view annotation checker and decision resolver.
      See Also:
      • AnnotatedViewAccessChecker
      • DefaultAccessCheckDecisionResolver
    • SpringNavigationAccessControl

      public SpringNavigationAccessControl(Collection<com.vaadin.flow.server.auth.NavigationAccessChecker> checkerList, com.vaadin.flow.server.auth.AccessCheckDecisionResolver decisionResolver)
      Create a new instance with given checkers and decision resolver.
      Parameters:
      checkerList - collection of navigation access checker.
      decisionResolver - the decision resolver.
  • Method Details

    • getPrincipal

      protected Principal getPrincipal(com.vaadin.flow.server.VaadinRequest request)
      Overrides:
      getPrincipal in class com.vaadin.flow.server.auth.NavigationAccessControl
    • getRolesChecker

      protected Predicate<String> getRolesChecker(com.vaadin.flow.server.VaadinRequest request)
      Overrides:
      getRolesChecker in class com.vaadin.flow.server.auth.NavigationAccessControl