Class RouteAccessConfiguration
java.lang.Object
de.codecamp.vaadin.security.spring.access.route.RouteAccessConfiguration
- All Implemented Interfaces:
Serializable
Allows to dynamically set the access rules for certain routes, navigation targets and parent
layouts. This will override rules defined on navigation targets and parent layouts directly via
SecuredAccess.
This is essentially the security counterpart for
RouteConfiguration. As such, there's an application and a session
scope, where the session scope can also see rules from the application scope. Both scopes
consider SecuredAccess annotations on navigation targets and parent layouts when they
have not been overriden.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic RouteAccessConfigurationReturns a configurator for application scoped access rules.static RouteAccessConfigurationReturns a configurator for session scoped access rules.getAccessRule(Class<?> targetOrLayout) Returns the effective access rule for the given navigation target or parent layout.getAccessRule(String routePath) Returns the effective access rule for the given route path.Returns all access rules registered route paths.Returns all access rules registered for navigation targets or parent layouts.voidremoveAccessRule(Class<? extends com.vaadin.flow.component.Component> targetOrLayout) Removes the access rule for the given navigation target or parent layout.voidremoveAccessRule(String routePath) Removes the access rule for the given route path.voidsetAccessRule(Class<? extends com.vaadin.flow.component.Component> targetOrLayout, AccessRule accessRule) Sets the access rule for the given navigation target or parent layout.voidsetAccessRule(String routePath, AccessRule accessRule) Sets the access rule for the given route path.
-
Method Details
-
forApplicationScope
Returns a configurator for application scoped access rules. This requires thatVaadinServlet.getCurrent()is populated.- Returns:
- configurator for application scoped access rules
-
forSessionScope
Returns a configurator for session scoped access rules. This requires thatVaadinSession.getCurrent()is populated.The session scope also returns access rules from the application scope.
- Returns:
- configurator for session scoped routes
-
setAccessRule
public void setAccessRule(Class<? extends com.vaadin.flow.component.Component> targetOrLayout, AccessRule accessRule) Sets the access rule for the given navigation target or parent layout.Setting an access rule for a path will take precedence over access rules set for the target class.
- Parameters:
targetOrLayout- the navigation target or parent layoutaccessRule- the access rule
-
removeAccessRule
Removes the access rule for the given navigation target or parent layout.- Parameters:
targetOrLayout- the navigation target or parent layout
-
getAccessRule
Returns the effective access rule for the given navigation target or parent layout.- Parameters:
targetOrLayout- the navigation target or parent layout- Returns:
- the effective access rule for the navigation target or parent layout
-
getRegisteredAccessRulesForTargetsAndLayouts
Returns all access rules registered for navigation targets or parent layouts.- Returns:
- all access rules registered for navigation targets or parent layouts
-
setAccessRule
Sets the access rule for the given route path.Setting an access rule for a path will take precedence over access rules set for the target class. Whether access rules for parent layouts are considered is still determined by
AccessRule.checkLayout().- Parameters:
routePath- the route pathaccessRule- the access rule
-
removeAccessRule
Removes the access rule for the given route path.- Parameters:
routePath- the route path
-
getAccessRule
Returns the effective access rule for the given route path.- Parameters:
routePath- the route path- Returns:
- the effective access rule for the given route path
-
getRegisteredAccessRulesForPaths
Returns all access rules registered route paths.- Returns:
- all access rules registered route paths
-