Class SpringNavigationAccessControl

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

public class SpringNavigationAccessControl extends 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:
  • Constructor Details

  • Method Details

    • getPrincipal

      protected Principal getPrincipal(VaadinRequest request)
      Description copied from class: NavigationAccessControl
      Gets the principal for the currently logged in user.
      Overrides:
      getPrincipal in class NavigationAccessControl
      Parameters:
      request - the current request or null if no request is in progress (e.g. in a background thread)
      Returns:
      a representation of the currently logged in user or null if no user is currently logged in
    • getRolesChecker

      protected Predicate<String> getRolesChecker(VaadinRequest request)
      Description copied from class: NavigationAccessControl
      Gets a function for checking roles for the currently logged in user.
      Overrides:
      getRolesChecker in class NavigationAccessControl
      Parameters:
      request - the current request or null if no request is in progress (e.g. in a background thread)
      Returns:
      a function which takes a role name and returns true if the user is included in that role