private Multimap<String, String> getCurrentPageState() { return navigation.getCurrentState(); }
private Multimap<String, String> getCurrentPageState() { return navigation.getCurrentState(); }
@Override public void observeEvent(final LifecycleEvent<C> event) { // There is no good way to inject the context within the bootstrapper. final SecurityContext securityContext = SecurityContextHoldingSingleton.getSecurityContext(); final Set<Role> roles = roleExtractor.extractAllRoles(annotation); if (!securityContext.isUserCacheValid() || !securityContext.hasCachedUser() || !securityContext.getCachedUser().getRoles().containsAll(roles)) { event.veto(); final Class<?> pageClass = Factory.maybeUnwrapProxy(event.getInstance()).getClass(); // This returns the correct state because Navigation sets the state when the request is made, but before it is // navigated to. final Multimap<String, String> pageState = securityContext.getNavigation().getCurrentState(); if (!securityContext.hasCachedUser()) securityContext.redirectToLoginPage(pageClass, pageState); else securityContext.redirectToSecurityErrorPage(pageClass, pageState); } }
@Override public void observeEvent(final LifecycleEvent<C> event) { // There is no good way to inject the context within the bootstrapper. final SecurityContext securityContext = SecurityContextHoldingSingleton.getSecurityContext(); final Set<Role> roles = roleExtractor.extractAllRoles(annotation); if (!securityContext.isUserCacheValid() || !securityContext.hasCachedUser() || !securityContext.getCachedUser().getRoles().containsAll(roles)) { event.veto(); final Class<?> pageClass = Factory.maybeUnwrapProxy(event.getInstance()).getClass(); // This returns the correct state because Navigation sets the state when the request is made, but before it is // navigated to. final Multimap<String, String> pageState = securityContext.getNavigation().getCurrentState(); if (!securityContext.hasCachedUser()) securityContext.redirectToLoginPage(pageClass, pageState); else securityContext.redirectToSecurityErrorPage(pageClass, pageState); } }