Class NavigationAccessDecisionService
java.lang.Object
com.svenruppert.jsentinel.authorization.navigation.NavigationAccessDecisionService
Pure decision service for navigation security.
This class contains no Vaadin dependencies and can be fully
unit-tested without BeforeEnterEvent, UI,
VaadinSession, or a running Vaadin application.
The decision flow covers:
- Public route — allow navigation
- Restricted route without subject — redirect to login (unless the target is already the login view)
- Restricted route with subject on login page — forward to default view (user is already logged in)
- Restricted route with subject — allow (authentication passed; authorization is checked separately)
Authorization (role/permission checks) is handled by
evaluateAuthorization(boolean, String, boolean), which is
called after authentication passes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates whether the current subject is authenticated for the given navigation context.evaluateAuthorization(boolean hasRequiredAccess, String alternativeRoute, boolean asForward) Evaluates whether the current subject has sufficient authorization (roles/permissions) for the requested route.
-
Constructor Details
-
NavigationAccessDecisionService
public NavigationAccessDecisionService()Creates a new instance.
-
-
Method Details
-
evaluateAuthorization
public NavigationAccessDecision evaluateAuthorization(boolean hasRequiredAccess, String alternativeRoute, boolean asForward) Evaluates whether the current subject has sufficient authorization (roles/permissions) for the requested route.This covers the authorization-check phase: does the subject have the required roles or permissions? Called after authentication passes.
- Parameters:
hasRequiredAccess- whether the subject satisfies the access requirementsalternativeRoute- the route to redirect to if access is deniedasForward- if true, use forward instead of reroute- Returns:
- the authorization-phase decision