Package com.vaadin.flow.spring.security
Class SpringNavigationAccessControl
java.lang.Object
com.vaadin.flow.server.auth.NavigationAccessControl
com.vaadin.flow.spring.security.SpringNavigationAccessControl
- All Implemented Interfaces:
BeforeEnterListener,BeforeEnterHandler,Serializable
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
ConstructorsConstructorDescriptionCreate a new instance with the default view annotation checker and decision resolver.SpringNavigationAccessControl(Collection<NavigationAccessChecker> checkerList, AccessCheckDecisionResolver decisionResolver) Create a new instance with given checkers and decision resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrincipalgetPrincipal(VaadinRequest request) Gets the principal for the currently logged in user.getRolesChecker(VaadinRequest request) Gets a function for checking roles for the currently logged in user.Methods inherited from class com.vaadin.flow.server.auth.NavigationAccessControl
beforeEnter, checkAccess, createNavigationContext, getAccessDeniedException, getLoginUrl, getLoginView, getRequestURL, hasAccessChecker, isEnabled, setEnabled, setLoginView, setLoginView
-
Constructor Details
-
SpringNavigationAccessControl
public SpringNavigationAccessControl()Create a new instance with the default view annotation checker and decision resolver.- See Also:
-
SpringNavigationAccessControl
public SpringNavigationAccessControl(Collection<NavigationAccessChecker> checkerList, 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
Description copied from class:NavigationAccessControlGets the principal for the currently logged in user.- Overrides:
getPrincipalin classNavigationAccessControl- Parameters:
request- the current request ornullif no request is in progress (e.g. in a background thread)- Returns:
- a representation of the currently logged in user or
nullif no user is currently logged in
-
getRolesChecker
Description copied from class:NavigationAccessControlGets a function for checking roles for the currently logged in user.- Overrides:
getRolesCheckerin classNavigationAccessControl- Parameters:
request- the current request ornullif no request is in progress (e.g. in a background thread)- Returns:
- a function which takes a role name and returns
trueif the user is included in that role
-