Class NavigationAccessControlConfigurer
NavigationAccessControl.
To configure Flow navigation access control, a Spring bean on type
NavigationAccessControlConfigurer should be defined.
In Spring Boot applications, a default
NavigationAccessControlConfigurer bean is provided. It activates
AnnotatedViewAccessChecker, but it disables the
NavigationAccessControl, for backward compatibility.
Default settings can be overridden by defining a custom
NavigationAccessControlConfigurer bean.
@Bean
NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
return new NavigationAccessControlConfigurer()
.withRoutePathAccessChecker().withLoginView(LoginView.class);
}
NavigationAccessControl bean can be configured by:
- activating out-of-the-box navigation access checkers
- providing custom navigation access checkers implementations
- set the login view class or path
- completely disable access control
The NavigationAccessControl will automatically be disabled if no
navigation access checkers are provided.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends NavigationAccessControl>
Tbuild(BiFunction<List<NavigationAccessChecker>, AccessCheckDecisionResolver, T> factory, List<NavigationAccessChecker> availableCheckers) Builds aNavigationAccessControlinstance, configured according to this configurer instance settings.disabled()Disables theNavigationAccessControl.Enables theAnnotatedViewAccessChecker.Adds toNavigationAccessControlall the registeredNavigationAccessCheckerbeans that matches the given filter.Sets theAccessCheckDecisionResolverfor the navigation access control.withLoginView(Class<? extends Component> loginView) Sets the Flow login view to use.withLoginView(String loginViewPath) Sets the path of the login view.withNavigationAccessChecker(NavigationAccessChecker accessChecker) Adds the givenNavigationAccessCheckerto the collection of checker that will be used byNavigationAccessControl.withNavigationAccessCheckers(Collection<NavigationAccessChecker> accessChecker) Adds the givenNavigationAccessCheckerto the collection of checker that will be used byNavigationAccessControl.Enables theRoutePathAccessChecker.
-
Constructor Details
-
NavigationAccessControlConfigurer
public NavigationAccessControlConfigurer()
-
-
Method Details
-
withAnnotatedViewAccessChecker
Enables theAnnotatedViewAccessChecker.- Returns:
- this instance for further customization.
-
withRoutePathAccessChecker
Enables theRoutePathAccessChecker.- Returns:
- this instance for further customization.
-
withDecisionResolver
Sets theAccessCheckDecisionResolverfor the navigation access control.The
AccessCheckDecisionResolveris responsible for taking the final decision on target view access grant, based on the response of the navigation access checkers.- Parameters:
resolver- the decision resolver to use for navigation access control.- Returns:
- this instance for further customization.
-
disabled
Disables theNavigationAccessControl.- Returns:
- this instance for further customization.
-
withLoginView
Sets the Flow login view to use.- Parameters:
loginView- the Flow view to use as login view- Returns:
- this instance for further customization.
-
withLoginView
Sets the path of the login view.- Parameters:
loginViewPath- the path of the login view- Returns:
- this instance for further customization.
-
build
public <T extends NavigationAccessControl> T build(BiFunction<List<NavigationAccessChecker>, AccessCheckDecisionResolver, T> factory, List<NavigationAccessChecker> availableCheckers) Builds aNavigationAccessControlinstance, configured according to this configurer instance settings.- Type Parameters:
T- the type of theNavigationAccessControl- Parameters:
factory- a function that build the desired type of navigation access control.availableCheckers- the list of all available navigation access checkers registered in the system.- Returns:
- a configured
NavigationAccessControlinstance, never null.
-