Package com.vaadin.flow.spring
Class SpringViewAccessChecker
java.lang.Object
com.vaadin.flow.server.auth.ViewAccessChecker
com.vaadin.flow.spring.SpringViewAccessChecker
- All Implemented Interfaces:
BeforeEnterListener,BeforeEnterHandler,Serializable
A Spring specific view access checker that falls back to Spring mechanisms
when the generic mechanisms do not work.
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.server.auth.ViewAccessChecker
SESSION_STORED_REDIRECT, SESSION_STORED_REDIRECT_ABSOLUTE -
Constructor Summary
ConstructorsConstructorDescriptionSpringViewAccessChecker(AccessAnnotationChecker accessAnnotationChecker) Creates an instance with the given annotation checker. -
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.ViewAccessChecker
beforeEnter, enable, setLoginView, setLoginView
-
Constructor Details
-
SpringViewAccessChecker
Creates an instance with the given annotation checker. The created instance is disabled by default.- Parameters:
accessAnnotationChecker- the annotation checker to use
-
-
Method Details
-
getPrincipal
Description copied from class:ViewAccessCheckerGets the principal for the currently logged in user.- Overrides:
getPrincipalin classViewAccessChecker- 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:ViewAccessCheckerGets a function for checking roles for the currently logged in user.- Overrides:
getRolesCheckerin classViewAccessChecker- 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
-